Esempio n. 1
0
 /// <summary>
 /// Is the point to the left of the edge?
 /// </summary>
 bool ToTheLeft(int pi, int li0, int li1)
 {
     if (li0 == -2)
     {
         return(Higher(li1, pi));
     }
     else if (li0 == -1)
     {
         return(Higher(pi, li1));
     }
     else if (li1 == -2)
     {
         return(Higher(pi, li0));
     }
     else if (li1 == -1)
     {
         return(Higher(li0, pi));
     }
     else
     {
         return(Geom.ToTheLeft(verts[pi], verts[li0], verts[li1]));
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Is the edge legal, or does it need to be flipped?
        /// </summary>
        bool LegalEdge(int k, int l, int i, int j)
        {
            var lMagic = l < 0;
            var iMagic = i < 0;
            var jMagic = j < 0;

            if (lMagic)
            {
                return(true);
            }
            else if (iMagic)
            {
                var p  = verts[l];
                var l0 = verts[k];
                var l1 = verts[j];

                return(Geom.ToTheLeft(p, l0, l1));
            }
            else if (jMagic)
            {
                var p  = verts[l];
                var l0 = verts[k];
                var l1 = verts[i];

                return(!Geom.ToTheLeft(p, l0, l1));
            }
            else
            {
                var p  = verts[l];
                var c0 = verts[k];
                var c1 = verts[i];
                var c2 = verts[j];

                return(!Geom.InsideCircumcircle(p, c0, c1, c2));
            }
        }