From 7e8749991e6a05377378331b66960d74e292da92 Mon Sep 17 00:00:00 2001 From: ccolin Date: Sat, 13 Nov 2021 18:06:02 +0100 Subject: [PATCH] minor improvements --- src/mesh_viewer.cpp | 1 - src/quad_patch_tesselator.cpp | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mesh_viewer.cpp b/src/mesh_viewer.cpp index 6cf2a93..62f5020 100644 --- a/src/mesh_viewer.cpp +++ b/src/mesh_viewer.cpp @@ -107,7 +107,6 @@ void MeshViewer::removeMesh(const MyMesh &mesh) { void MeshViewer::updateForReal() { - qDebug() << "trying to update"; setEnabled(true); setVisible(true); update(); diff --git a/src/quad_patch_tesselator.cpp b/src/quad_patch_tesselator.cpp index 98f9414..156ef7d 100644 --- a/src/quad_patch_tesselator.cpp +++ b/src/quad_patch_tesselator.cpp @@ -7,6 +7,8 @@ MyMesh tesselate_quad_patch(QuadPatch q, MyMesh mesh, VertexHandle vh) { Eigen::Vector3d point (mesh.point(vh)[0], mesh.point(vh)[1], mesh.point(vh)[2]); point = q.transform() * point; + + // Recherche des dimensions englobantes du 1-anneau de vh double xmin = point[0], xmax = point[0]; double ymin = point[1], ymax = point[1]; for (VertexHandle vi : mesh.vv_range(vh)) { @@ -18,6 +20,8 @@ MyMesh tesselate_quad_patch(QuadPatch q, MyMesh mesh, VertexHandle vh) { ymin = std::min(ymin, point[1]); ymax = std::max(ymax, point[1]); } + + // Générations des sommets double xstep = (xmax-xmin)/static_cast(patch_divs); double ystep = (ymax-ymin)/static_cast(patch_divs); for (size_t y = 0; y < patch_divs; y++) { @@ -29,12 +33,17 @@ MyMesh tesselate_quad_patch(QuadPatch q, MyMesh mesh, VertexHandle vh) { patch.new_vertex(Point(point[0], point[1], point[2])); } } + + // Générations des triangles for (VertexHandle vhi : patch.vertices()) { patch.set_color(vhi, MyMesh::Color(0, 1, .2)); size_t i = vhi.idx(); size_t x = i % patch_divs; size_t y = i / patch_divs; + + // On ignore la dernière colonne et dernière ligne if (x == patch_divs - 1 || y == patch_divs - 1) continue; + patch.add_face(vhi, patch.vertex_handle(i + patch_divs), patch.vertex_handle(i + 1)); patch.add_face(patch.vertex_handle(i + 1),