From: Roger Stafford on 9 Aug 2010 20:04 "Catarina Avelino" <cavelino(a)mat.uc.pt> wrote in message <i3q0nh$5jh$1(a)fred.mathworks.com>... > 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 - - - - - - - - - - - - You have stated that all of your angles in the triangles are less than pi radians. With that understanding, if your triangle has three vertices with coordinates V1 = (x1,y1,z1), V2 = (x2,y2,z2), and V3 = (x3,y3,z3), that satisfy det([x1,y1,z1;x2,y2,z2;x3,y3,z3]) > 0 then the vertices V1, V2, V3 will be in counterclockwise order as you move around the triangle in that sequence as viewed from outside the sphere looking inward. If this determinant is negative their order is clockwise. To ensure that your ABC triangle does not overlap ACD, you should make the sequence A, C, B opposite in orientation to that of A, C, D. In other words choose D1 or D2 whichever one gives this opposite orientation. As you travel along the arc from A to C, the triangle that is on the left will clearly have a counterclockwise orientation and that on the right a clockwise orientation, so you must make your choice between D1 and D2 accordingly. Generating random S points in the interiors of the triangles is definitely not the way to decide this overlapping question! That would make a most unsatisfactory algorithm. You might grow old waiting for your computer to make a proper decision. There are after all infinitely many points to inspect in their interiors. It would make more sense to generate one point known to be in the interior of one triangle and then to ask whether it also lay inside the other triangle. However, that is still far more work than is necessary. Roger Stafford
From: Roger Stafford on 9 Aug 2010 20:13 "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <i3q51l$3b5$1(a)fred.mathworks.com>... > ....... It would make more sense to generate one point known to be in the interior of one triangle and then to ask whether it also lay inside the other triangle. However, that is still far more work than is necessary. > > Roger Stafford - - - - - - - - - - Whoops! Cancel those last two sentences that begin with "It would make more sense ....." It was a mental aberration. Just stick to the determinant method. Roger Stafford
From: Catarina Avelino on 10 Aug 2010 05:27
"Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <i3q5ig$5pl$1(a)fred.mathworks.com>... > "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <i3q51l$3b5$1(a)fred.mathworks.com>... > > ....... It would make more sense to generate one point known to be in the interior of one triangle and then to ask whether it also lay inside the other triangle. However, that is still far more work than is necessary. > > > > Roger Stafford > - - - - - - - - - - > Whoops! Cancel those last two sentences that begin with "It would make more sense ....." It was a mental aberration. Just stick to the determinant method. > > Roger Stafford Thank you very much for your help! Catarina |