private void DuplicateIfSharedAtIndex(Triangle<Vertex> triangle, Vertex toDuplicate) { int index = triangle.VertexIndex(toDuplicate); if (index >= 0) { Vertex newVertex = new Vertex { Id = vertexIndex++, Position3D = new Vector3(toDuplicate.Position3D.x, toDuplicate.Position3D.y, toDuplicate.Position3D.z) }; triangle.Vertices[index] = newVertex; Vertices.Add(newVertex); } }