/// <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!"); } }
/// <summary> /// Exhaustive search to update neighbor pointers /// </summary> public void MarkNeighbor(DelaunayTriangle t) { if (t.Contains(Points[1], Points[2])) { Neighbors[0] = t; t.MarkNeighbor(Points[1], Points[2], this); } else if (t.Contains(Points[0], Points[2])) { Neighbors[1] = t; t.MarkNeighbor(Points[0], Points[2], this); } else if (t.Contains(Points[0], Points[1])) { Neighbors[2] = t; t.MarkNeighbor(Points[0], Points[1], this); } else { Debug.WriteLine("markNeighbor failed"); } }
/// <summary> /// Exhaustive search to update neighbor pointers /// </summary> public void MarkNeighbor( DelaunayTriangle t ) { if( t.Contains( points[1], points[2] ) ) { neighbors[0] = t; t.MarkNeighbor( points[1], points[2], this ); } else if( t.Contains( points[0], points[2] ) ) { neighbors[1] = t; t.MarkNeighbor( points[0], points[2], this ); } else if( t.Contains( points[0], points[1] ) ) { neighbors[2] = t; t.MarkNeighbor( points[0], points[1], this ); } else { Debug.WriteLine( "markNeighbor failed" ); } }