public void AddVertexTest() { var T2 = new Triangulation(T.Triangles); T2.AddVertex(new Vector2(1, 0.5f)); Assert.AreEqual(4, T2.Triangles.Count); Assert.IsFalse(T2.Triangles.Contains(t1)); }
/// <summary> /// Adds a vertex at the given position to the Delaunay triangulation. /// Legalizes relevant edges in order to maintain Delaunay condition. /// </summary> /// <param name="T"></param> /// <param name="a_vertex"></param> /// <returns></returns> public static void AddVertex(Triangulation T, Vector2 a_vertex) { // find triangle that contains X var triangle = T.FindContainingTriangle(a_vertex); T.AddVertex(a_vertex); // Flip if needed LegalizeEdge(T, a_vertex, triangle.E0); LegalizeEdge(T, a_vertex, triangle.E1); LegalizeEdge(T, a_vertex, triangle.E2); }