private TriMesh.HalfEdge[] FindGroup(TriMesh.Vertex v, TriMesh.Vertex begin, TriMesh.Vertex end) { List<TriMesh.HalfEdge> group = new List<TriMesh.HalfEdge>(); TriMesh.HalfEdge start = v.FindHalfedgeTo(begin); group.Add(start); TriMesh.HalfEdge current = start; while (current.ToVertex != end) { current = current.Opposite.Next; group.Add(current); } return group.ToArray(); }
TriMesh.HalfEdge Validate(TriMesh.Vertex from, TriMesh.Vertex to) { TriMesh mesh = (TriMesh)from.Mesh; if (from == null) { throw new ArgumentNullException("Can't add a null vertex to a face."); } if (!from.OnBoundary) { throw new BadTopologyException("Can't add an edge to a vertex on the interior of a mesh."); } // Find existing halfedges for this face TriMesh.HalfEdge hf = from.FindHalfedgeTo(to); if (hf != null && !hf.OnBoundary) { throw new BadTopologyException("Can't add more than two faces to an edge."); } return hf; }
public static TriMesh.Edge FindEdge(TriMesh.Vertex v1, TriMesh.Vertex v2) { TriMesh.HalfEdge hf = v1.FindHalfedgeTo(v2); return hf == null ? null : hf.Edge; }