public void MarkNeighbor(DelaunayTriangle t) { bool flag = t.Contains(this.Points[0]); bool flag2 = t.Contains(this.Points[1]); bool flag3 = t.Contains(this.Points[2]); if (flag2 && flag3) { this.Neighbors[0] = t; t.MarkNeighbor(this.Points[1], this.Points[2], this); } else if (flag && flag3) { this.Neighbors[1] = t; t.MarkNeighbor(this.Points[0], this.Points[2], this); } else { if (!flag || !flag2) { throw new Exception("Failed to mark neighbor, doesn't share an edge!"); } this.Neighbors[2] = t; t.MarkNeighbor(this.Points[0], this.Points[1], this); } }
/// <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 ) { // 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!"); }