minor improvements

This commit is contained in:
ccolin 2021-11-13 18:06:02 +01:00
parent a8f9e1db56
commit 7e8749991e
2 changed files with 9 additions and 1 deletions

View File

@ -107,7 +107,6 @@ void MeshViewer::removeMesh(const MyMesh &mesh) {
void MeshViewer::updateForReal() {
qDebug() << "trying to update";
setEnabled(true);
setVisible(true);
update();

View File

@ -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<double>(patch_divs);
double ystep = (ymax-ymin)/static_cast<double>(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),