/// <summary> /// add topological edges/vertices as constraints for remeshing /// </summary> public void AddRemeshConstraints(MeshConstraints constraints) { validate_topology(); int set_index = 10; foreach (EdgeSpan span in Spans) { var target = new DCurveProjectionTarget(span.ToCurve()); MeshConstraintUtil.ConstrainVtxSpanTo(constraints, Mesh, span.Vertices, target, set_index++); } foreach (EdgeLoop loop in Loops) { var target = new DCurveProjectionTarget(loop.ToCurve()); MeshConstraintUtil.ConstrainVtxLoopTo(constraints, Mesh, loop.Vertices, target, set_index++); } VertexConstraint corners = VertexConstraint.Pinned; corners.FixedSetID = -1; foreach (int vid in JunctionVertices) { if (constraints.HasVertexConstraint(vid)) { VertexConstraint v = constraints.GetVertexConstraint(vid); v.Target = null; v.Fixed = true; v.FixedSetID = -1; constraints.SetOrUpdateVertexConstraint(vid, v); } else { constraints.SetOrUpdateVertexConstraint(vid, corners); } } }