Ejemplo n.º 1
0
 /// <summary>
 /// Legalize triagnle by rotating clockwise around oPoint
 /// </summary>
 /// <param name="opoint"></param>
 /// <param name="npoint"></param>
 public void Legalize(TriPoint opoint, TriPoint npoint)
 {
     if (opoint.Equals(Points[0]))
     {
         Points[1] = Points[0];
         Points[0] = Points[2];
         Points[2] = npoint;
     }
     else if (opoint.Equals(Points[1]))
     {
         Points[2] = Points[1];
         Points[1] = Points[0];
         Points[0] = npoint;
     }
     else if (opoint.Equals(Points[2]))
     {
         Points[0] = Points[2];
         Points[2] = Points[1];
         Points[1] = npoint;
     }
     else
     {
         Debug.Assert(false, "What happened here????");
     }
 }
Ejemplo n.º 2
0
        public Triangle NeighborAcross(TriPoint opoint)
        {
            if (opoint.Equals(Points[0]))
            {
                return(_neighbours[0]);
            }
            else if (opoint.Equals(Points[1]))
            {
                return(_neighbours[1]);
            }

            return(_neighbours[2]);
        }
Ejemplo n.º 3
0
        public bool GetDelaunayEdgeCW(TriPoint p)
        {
            if (p.Equals(Points[0]))
            {
                return(DelaunayEdge[1]);
            }
            else if (p.Equals(Points[1]))
            {
                return(DelaunayEdge[2]);
            }

            return(DelaunayEdge[0]);
        }
Ejemplo n.º 4
0
        public bool GetConstrainedEdgeCW(TriPoint p)
        {
            if (p.Equals(Points[0]))
            {
                return(ConstrainedEdge[1]);
            }
            else if (p.Equals(Points[1]))
            {
                return(ConstrainedEdge[2]);
            }

            return(ConstrainedEdge[0]);
        }
Ejemplo n.º 5
0
        public Triangle NeighborCCW(TriPoint point)
        {
            if (point.Equals(Points[0]))
            {
                return(_neighbours[2]);
            }
            else if (point.Equals(Points[1]))
            {
                return(_neighbours[0]);
            }

            return(_neighbours[1]);
        }
Ejemplo n.º 6
0
 public void SetDelunayEdgeCW(TriPoint p, bool e)
 {
     if (p.Equals(Points[0]))
     {
         DelaunayEdge[1] = e;
     }
     else if (p.Equals(Points[1]))
     {
         DelaunayEdge[2] = e;
     }
     else
     {
         DelaunayEdge[0] = e;
     }
 }
Ejemplo n.º 7
0
 public void SetConstrainedEdgeCW(TriPoint p, bool ce)
 {
     if (p.Equals(Points[0]))
     {
         ConstrainedEdge[1] = ce;
     }
     else if (p.Equals(Points[1]))
     {
         ConstrainedEdge[2] = ce;
     }
     else
     {
         ConstrainedEdge[0] = ce;
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Mark edge as constrained
 /// </summary>
 /// <param name="p"></param>
 /// <param name="q"></param>
 public void MarkConstrainedEdge(TriPoint p, TriPoint q)
 {
     if ((q.Equals(Points[0]) && p.Equals(Points[1])) || (q.Equals(Points[1]) && p.Equals(Points[0])))
     {
         ConstrainedEdge[2] = true;
     }
     else if ((q.Equals(Points[0]) && p.Equals(Points[2])) || (q.Equals(Points[2]) && p.Equals(Points[0])))
     {
         ConstrainedEdge[1] = true;
     }
     else if ((q.Equals(Points[1]) && p.Equals(Points[2])) || (q.Equals(Points[2]) && p.Equals(Points[1])))
     {
         ConstrainedEdge[0] = true;
     }
 }
Ejemplo n.º 9
0
        /// <summary>
        /// The point counter-clockwise to given point
        /// </summary>
        /// <param name="point"></param>
        /// <returns></returns>
        public TriPoint PointCCW(TriPoint point)
        {
            if (point.Equals(Points[0]))
            {
                return(Points[1]);
            }
            else if (point.Equals(Points[1]))
            {
                return(Points[2]);
            }
            else if (point.Equals(Points[2]))
            {
                return(Points[0]);
            }

            Debug.Assert(false, "What happened here????");
            return(TriPoint.Empty);
        }
Ejemplo n.º 10
0
        public int Index(TriPoint p)
        {
            if (p.Equals(Points[0]))
            {
                return(0);
            }
            else if (p.Equals(Points[1]))
            {
                return(1);
            }
            else if (p.Equals(Points[2]))
            {
                return(2);
            }

            Debug.Assert(false, "What happened here????");
            return(-1);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Update neighbor pointers
 /// </summary>
 /// <param name="p1"></param>
 /// <param name="p2"></param>
 /// <param name="t"></param>
 public void MarkNeighbor(TriPoint p1, TriPoint p2, Triangle t)
 {
     if ((p1.Equals(Points[2]) && p2.Equals(Points[1])) || (p1.Equals(Points[1]) && p2.Equals(Points[2])))
     {
         _neighbours[0] = t;
     }
     else if ((p1.Equals(Points[0]) && p2.Equals(Points[2])) || (p1.Equals(Points[2]) && p2.Equals(Points[0])))
     {
         _neighbours[1] = t;
     }
     else if ((p1.Equals(Points[0]) && p2.Equals(Points[1])) || (p1.Equals(Points[1]) && p2.Equals(Points[0])))
     {
         _neighbours[2] = t;
     }
     else
     {
         Debug.Assert(false, "Specified trianlge is not a neighbor");
     }
 }