Beispiel #1
0
        /// <summary>
        /// Exhaustive search to update neighbor pointers
        /// </summary>
        public void MarkNeighbor(DelaunayTriangle t)
        {
            // Points of this triangle also belonging to t
            bool a = t.Contains(Points[0]);
            bool b = t.Contains(Points[1]);
            bool c = t.Contains(Points[2]);

            if (b && c)
            {
                Neighbors[0] = t; t.MarkNeighbor(Points[1], Points[2], this);
            }
            else if (a && c)
            {
                Neighbors[1] = t; t.MarkNeighbor(Points[0], Points[2], this);
            }
            else if (a && b)
            {
                Neighbors[2] = t; t.MarkNeighbor(Points[0], Points[1], this);
            }
            else
            {
                throw new Exception("Failed to mark neighbor, doesn't share an edge!");
            }
        }