public void MarkEdge(DelaunayTriangle triangle) { for (int i = 0; i < 3; i++) if (EdgeIsConstrained[i]) { triangle.MarkConstrainedEdge(Points[(i + 1)%3], Points[(i + 2)%3]); } }
public void AddTriangle(DelaunayTriangle t) { _triangles.Add(t); }
/// <param name="t">Opposite triangle</param> /// <param name="p">The point in t that isn't shared between the triangles</param> public TriangulationPoint OppositePoint(DelaunayTriangle t, TriangulationPoint p) { Debug.Assert(t != this, "self-pointer error"); return PointCW(t.PointCW(p)); }
public void ClearNeighbor(DelaunayTriangle triangle) { if (Neighbors[0] == triangle) { Neighbors[0] = null; } else if (Neighbors[1] == triangle) { Neighbors[1] = null; } else { Neighbors[2] = null; } }
/// <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> /// Update neighbor pointers /// </summary> /// <param name="p1">Point 1 of the shared edge</param> /// <param name="p2">Point 2 of the shared edge</param> /// <param name="t">This triangle's new neighbor</param> private void MarkNeighbor(TriangulationPoint p1, TriangulationPoint p2, DelaunayTriangle t) { if ((p1 == Points[2] && p2 == Points[1]) || (p1 == Points[1] && p2 == Points[2])) { Neighbors[0] = t; } else if ((p1 == Points[0] && p2 == Points[2]) || (p1 == Points[2] && p2 == Points[0])) { Neighbors[1] = t; } else if ((p1 == Points[0] && p2 == Points[1]) || (p1 == Points[1] && p2 == Points[0])) { Neighbors[2] = t; } else { Debug.WriteLine("Neighbor error, please report!"); // throw new Exception("Neighbor error, please report!"); } }
/// <param name="t">Opposite triangle</param> /// <param name="p">The point in t that isn't shared between the triangles</param> public TriangulationPoint OppositePoint(DelaunayTriangle t, TriangulationPoint p) { Debug.Assert(t != this, "self-pointer error"); return(PointCW(t.PointCW(p))); }