Skip to content

Instantly share code, notes, and snippets.

@rms80
Created April 13, 2018 03:16
Show Gist options
  • Save rms80/c1512d32e9f8ea6ce539801ef111bbf2 to your computer and use it in GitHub Desktop.
Save rms80/c1512d32e9f8ea6ce539801ef111bbf2 to your computer and use it in GitHub Desktop.
MeshInsertUVPolyCurve debugging code
// at top of Apply()
DMesh3 saveMesh = new DMesh3(Mesh);
insert_corners();
DMesh3 pokedMesh = new DMesh3(Mesh);
// to append segments to pokedMesh (in si loop)
MeshEditor.AppendLine(pokedMesh, new Segment3d(Mesh.GetVertex(i0_vid), Mesh.GetVertex(i1_vid)), 0.003f);
// write out files
if (OnCutEdges.Count == XX) {
foreach (int eid in OnCutEdges) {
Index2i ev = Mesh.GetEdgeV(eid);
Segment3d seg = new Segment3d(Mesh.GetVertex(ev.a), Mesh.GetVertex(ev.b));
MeshEditor.AppendLine(saveMesh, seg, 0.0025f);
}
HashSet<int> verts = new HashSet<int>();
IndexUtil.EdgesToVertices(Mesh, OnCutEdges, verts);
foreach ( int vid in verts ) {
int count = 0;
foreach (int eid in Mesh.VtxEdgesItr(vid))
if (OnCutEdges.Contains(eid)) count++;
if (count != 2) {
System.Console.WriteLine("vert {0} count {1}", vid, count);
MeshEditor.AppendBox(saveMesh, Mesh.GetVertex(vid), 0.005f);
}
}
Util.WriteDebugMesh(saveMesh, "c:\\scratch\\__INSERT_SEGMENTS.obj");
Util.WriteDebugMesh(Mesh, "c:\\scratch\\__INSERT_RESULT.obj");
Util.WriteDebugMesh(pokedMesh, "c:\\scratch\\__INSERT_POKED.obj");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment