Example #1
0
        /// <summary>
        /// Try to map a node to all sides of this triangle that don't have
        /// a neighbor.
        /// </summary>
        public void MapTriangleToNodes(DelaunayTriangle t)
        {
            //for (int i = 0; i < 3; i++)
            //    if (t.Neighbors[i] == null)
            //    {
            //        AdvancingFrontNode n = Front.LocatePoint(t.PointCWFrom(t.Points[i]));
            //        if (n != null) n.Triangle = t;
            //    }

            //------------------------------
            //PointCWFrom
            //(FindIndexOf(0) + 2) % 3=>2
            //(FindIndexOf(1) + 2) % 3=>0
            //(FindIndexOf(2) + 2) % 3=>1
            //------------------------------

            if (t.N0 == null)
            {
                //AdvancingFrontNode n = Front.LocatePoint(t.PointCWFrom(t.P0));
                //(FindIndexOf(0) + 2) % 3=>2

                AdvancingFrontNode n = Front.LocatePoint(t.P2);
                if (n != null)
                {
                    n.Triangle = t;
                }
            }
            if (t.N1 == null)
            {
                //(FindIndexOf(1) + 2) % 3=>0
                AdvancingFrontNode n = Front.LocatePoint(t.P0);
                if (n != null)
                {
                    n.Triangle = t;
                }
            }
            if (t.N2 == null)
            {
                AdvancingFrontNode n = Front.LocatePoint(t.P1);
                if (n != null)
                {
                    n.Triangle = t;
                }
            }
        }
Example #2
0
 /// <summary>
 /// Try to map a node to all sides of this triangle that don't have
 /// a neighbor.
 /// </summary>
 public void MapTriangleToNodes(DelaunayTriangle t)
 {
     for (int i = 0; i < 3; i++)
     {
         if (t.Neighbors[i] == null)
         {
             AdvancingFrontNode n = Front.LocatePoint(t.PointCWFrom(t.Points[i]));
             if (n != null)
             {
                 n.Triangle = t;
             }
         }
     }
 }