From: Catarina Avelino on
I have two points on a sphere (x1,y1,z1) and (x2,y2,z2) that are vertices of a spherical triangle (I considered a sphere of center (0,0,0) and radius 1).

I need to know the coordinates of the other 3rd vertex of the spherical triangle. I know the three angles of the spherical triangle and also the three edge lengths.

I suppose that, in general, there exist 2 solutions for this problem. I need to know how to determine the solutions available.

Thanks,
Catarina
From: Roger Stafford on
"Catarina Avelino" <cavelino(a)mat.uc.pt> wrote in message <i3k6lo$34v$1(a)fred.mathworks.com>...
> I have two points on a sphere (x1,y1,z1) and (x2,y2,z2) that are vertices of a spherical triangle (I considered a sphere of center (0,0,0) and radius 1).
>
> I need to know the coordinates of the other 3rd vertex of the spherical triangle. I know the three angles of the spherical triangle and also the three edge lengths.
>
> I suppose that, in general, there exist 2 solutions for this problem. I need to know how to determine the solutions available.
>
> Thanks,
> Catarina
- - - - - - - - - - - -
All you need are the two (dihedral) angles at either end of the side (arc) between P1 = [x1,y1,z1] and P2 = [x2,y2,z2], and that is what will be assumed here. Call the angle at the P1 vertex a1 and the one at the P2 vertex a2, both in radians.

P1 = P1/norm(P1); P2 = P2/norm(P2); % Make sure they're unit vectors
Q = cross(P1,P2); Q = Q/norm(Q); % Normalize their cross product
R1 = cross(Q,P1); R2 = cross(P2,Q);
P3 = cross(R2*sin(a2)-Q*cos(a2),R1*sin(a1)-Q*cos(a1));
P3 = P3/norm(P3); % Make P3 a unit vector
P4 = cross(R1*sin(a1)+Q*cos(a1),R2*sin(a2)+Q*cos(a2));
P4 = P4/norm(P4); % Make P4 a unit vector

As one moves from P1 to P2, the points P3 and P4 are the third vertices assuming the triangle lies to the left or to the right, respectively.

Roger Stafford
From: Catarina Avelino on
"Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <i3l0m8$8f7$1(a)fred.mathworks.com>...
> "Catarina Avelino" <cavelino(a)mat.uc.pt> wrote in message <i3k6lo$34v$1(a)fred.mathworks.com>...
> > I have two points on a sphere (x1,y1,z1) and (x2,y2,z2) that are vertices of a spherical triangle (I considered a sphere of center (0,0,0) and radius 1).
> >
> > I need to know the coordinates of the other 3rd vertex of the spherical triangle. I know the three angles of the spherical triangle and also the three edge lengths.
> >
> > I suppose that, in general, there exist 2 solutions for this problem. I need to know how to determine the solutions available.
> >
> > Thanks,
> > Catarina
> - - - - - - - - - - - -
> All you need are the two (dihedral) angles at either end of the side (arc) between P1 = [x1,y1,z1] and P2 = [x2,y2,z2], and that is what will be assumed here. Call the angle at the P1 vertex a1 and the one at the P2 vertex a2, both in radians.
>
> P1 = P1/norm(P1); P2 = P2/norm(P2); % Make sure they're unit vectors
> Q = cross(P1,P2); Q = Q/norm(Q); % Normalize their cross product
> R1 = cross(Q,P1); R2 = cross(P2,Q);
> P3 = cross(R2*sin(a2)-Q*cos(a2),R1*sin(a1)-Q*cos(a1));
> P3 = P3/norm(P3); % Make P3 a unit vector
> P4 = cross(R1*sin(a1)+Q*cos(a1),R2*sin(a2)+Q*cos(a2));
> P4 = P4/norm(P4); % Make P4 a unit vector
>
> As one moves from P1 to P2, the points P3 and P4 are the third vertices assuming the triangle lies to the left or to the right, respectively.
>
> Roger Stafford

Thanks!!
It is possible to create a set of the points inside a spherical triangle? I explain... Suppose that I have already drawn a spherical triangle T1 in the sphere and let S1 be the set of all points of the sphere that lie inside that spherical triangle (excluding the boundary). I will consider another spherical triangle T2 with 2 vertices in common with T1 (the triangles are in adjacent positions). Given your answer, I have two possibilities for T2 (corresponding to your possibilities for the third vertex), although only one is of interest (the one that have no points in the interior of T1 and T2 simultaneously). If I could consider S1 and S2 (this last corresponding to the set of all points of the sphere that lie inside that spherical triangle T2, excluding the boundary), I have the possibility to test the intersection of S1 with S2 and make the choice of the third vertex of the new
triangle on this basis.
It is possible to do that?
Thanks again,
Catarina Avelino
From: Roger Stafford on
"Catarina Avelino" <cavelino(a)mat.uc.pt> wrote in message <i3ouc4$jve$1(a)fred.mathworks.com>...
> Thanks!!
> It is possible to create a set of the points inside a spherical triangle? I explain... Suppose that I have already drawn a spherical triangle T1 in the sphere and let S1 be the set of all points of the sphere that lie inside that spherical triangle (excluding the boundary). I will consider another spherical triangle T2 with 2 vertices in common with T1 (the triangles are in adjacent positions). Given your answer, I have two possibilities for T2 (corresponding to your possibilities for the third vertex), although only one is of interest (the one that have no points in the interior of T1 and T2 simultaneously). If I could consider S1 and S2 (this last corresponding to the set of all points of the sphere that lie inside that spherical triangle T2, excluding the boundary), I have the possibility to test the intersection of S1 with S2 and make the choice of the third vertex of the new
> triangle on this basis.
> It is possible to do that?
> Thanks again,
> Catarina Avelino
- - - - - - - - - - -
In the last paragraph I said "As one moves from P1 to P2, the points P3 and P4 are the third vertices assuming the triangle lies to the left or to the right, respectively." By that I meant that as you move along the arc from P1 to P2, the points to the immediate left side of the arc belong to the triangle P1P2P3 and the points to the immediate right side of the arc belong to triangle P1P2P4. Hence if you used P1 and P2 as common points between two different triangles, to prevent them from having points in common you must select the "P3" type vertex for one of the triangles and the "P4" type for the other triangle. (By "P3 type" or "P4 type" I mean the points created by the algorithm I gave using P1 and P2 which I have called P3 and P4, respectively.)

However you should realize that this is no guarantee that the two triangles won't overlap. It is easily possible for very large triangles to occupy points in common in spite of taking this precaution. For example, if the "spherical excess" of each triangle (the amount by which the sum of its angle exceeds pi) is greater than 2*pi, then the sum of the areas of the two triangle would be greater than the area of the whole sphere so they would necessarily overlap.

On the other hand, if you know that both of the angles at P1 and P2 are less than pi for each of the two triangles, you could safely conclude that the above P3/P4 precaution would then prevent them from overlapping, since the triangles would be limited to opposite sides of the great circle plane running through P1P2.

If you meant something beyond the above when you said "create a set of the points inside a spherical triangle", please let me know.

Roger Stafford
From: Catarina Avelino on
"Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <i3pg2c$o42$1(a)fred.mathworks.com>...
> "Catarina Avelino" <cavelino(a)mat.uc.pt> wrote in message <i3ouc4$jve$1(a)fred.mathworks.com>...
> > Thanks!!
> > It is possible to create a set of the points inside a spherical triangle? I explain... Suppose that I have already drawn a spherical triangle T1 in the sphere and let S1 be the set of all points of the sphere that lie inside that spherical triangle (excluding the boundary). I will consider another spherical triangle T2 with 2 vertices in common with T1 (the triangles are in adjacent positions). Given your answer, I have two possibilities for T2 (corresponding to your possibilities for the third vertex), although only one is of interest (the one that have no points in the interior of T1 and T2 simultaneously). If I could consider S1 and S2 (this last corresponding to the set of all points of the sphere that lie inside that spherical triangle T2, excluding the boundary), I have the possibility to test the intersection of S1 with S2 and make the choice of the third vertex of the new
> > triangle on this basis.
> > It is possible to do that?
> > Thanks again,
> > Catarina Avelino
> - - - - - - - - - - -
> In the last paragraph I said "As one moves from P1 to P2, the points P3 and P4 are the third vertices assuming the triangle lies to the left or to the right, respectively." By that I meant that as you move along the arc from P1 to P2, the points to the immediate left side of the arc belong to the triangle P1P2P3 and the points to the immediate right side of the arc belong to triangle P1P2P4. Hence if you used P1 and P2 as common points between two different triangles, to prevent them from having points in common you must select the "P3" type vertex for one of the triangles and the "P4" type for the other triangle. (By "P3 type" or "P4 type" I mean the points created by the algorithm I gave using P1 and P2 which I have called P3 and P4, respectively.)
>
> However you should realize that this is no guarantee that the two triangles won't overlap. It is easily possible for very large triangles to occupy points in common in spite of taking this precaution. For example, if the "spherical excess" of each triangle (the amount by which the sum of its angle exceeds pi) is greater than 2*pi, then the sum of the areas of the two triangle would be greater than the area of the whole sphere so they would necessarily overlap.
>
> On the other hand, if you know that both of the angles at P1 and P2 are less than pi for each of the two triangles, you could safely conclude that the above P3/P4 precaution would then prevent them from overlapping, since the triangles would be limited to opposite sides of the great circle plane running through P1P2.
>
> If you meant something beyond the above when you said "create a set of the points inside a spherical triangle", please let me know.
>
> Roger Stafford

The problem is that I do not know if "the triangle lies to the left or to the right" (I am trying to make a code to decide it, but I not yet realized how). I will try to explain better the idea. Note that in this problem the angles of all spherical triangles are less than pi and the interior of two spherical triangles won't overlap (not including the boundaries of the triangles, that overlap when there are edges in common).
So, suppose that I have drawn a spherical triangle ABC. And now I want to draw another spherical triangle, for example ACD, in adjacent positions (with edge AC in common). With your answer I will have two possibilities for vertex D and consequently two possibilities for the spherical triangle (say ACD1 and ACD2, consonant the triangle lies to the left or to the right). I need to choose the right option, i.e, the one that makes that the interior of the triangles will not overlap.
For this reason I thought to consider three sets S, S1 and S2 corresponding to the set of all points of the sphere that lie inside the spherical triangles ABC, ACD1 and ACD2, respectively, and to test the intersection of S with both S1 and S2. In one case the intersection is empty and in the other case is not empty. The right option will be the triangle that leads to the empty intersection. The question is I do not know how to put this in a matlab code and if it is possible to make that.
Thanks,
Catarina