minor improvements
This commit is contained in:
parent
a8f9e1db56
commit
7e8749991e
@ -107,7 +107,6 @@ void MeshViewer::removeMesh(const MyMesh &mesh) {
|
|||||||
|
|
||||||
|
|
||||||
void MeshViewer::updateForReal() {
|
void MeshViewer::updateForReal() {
|
||||||
qDebug() << "trying to update";
|
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
update();
|
update();
|
||||||
|
@ -7,6 +7,8 @@ MyMesh tesselate_quad_patch(QuadPatch q, MyMesh mesh, VertexHandle vh) {
|
|||||||
Eigen::Vector3d point
|
Eigen::Vector3d point
|
||||||
(mesh.point(vh)[0], mesh.point(vh)[1], mesh.point(vh)[2]);
|
(mesh.point(vh)[0], mesh.point(vh)[1], mesh.point(vh)[2]);
|
||||||
point = q.transform() * point;
|
point = q.transform() * point;
|
||||||
|
|
||||||
|
// Recherche des dimensions englobantes du 1-anneau de vh
|
||||||
double xmin = point[0], xmax = point[0];
|
double xmin = point[0], xmax = point[0];
|
||||||
double ymin = point[1], ymax = point[1];
|
double ymin = point[1], ymax = point[1];
|
||||||
for (VertexHandle vi : mesh.vv_range(vh)) {
|
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]);
|
ymin = std::min(ymin, point[1]);
|
||||||
ymax = std::max(ymax, point[1]);
|
ymax = std::max(ymax, point[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Générations des sommets
|
||||||
double xstep = (xmax-xmin)/static_cast<double>(patch_divs);
|
double xstep = (xmax-xmin)/static_cast<double>(patch_divs);
|
||||||
double ystep = (ymax-ymin)/static_cast<double>(patch_divs);
|
double ystep = (ymax-ymin)/static_cast<double>(patch_divs);
|
||||||
for (size_t y = 0; y < patch_divs; y++) {
|
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]));
|
patch.new_vertex(Point(point[0], point[1], point[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Générations des triangles
|
||||||
for (VertexHandle vhi : patch.vertices()) {
|
for (VertexHandle vhi : patch.vertices()) {
|
||||||
patch.set_color(vhi, MyMesh::Color(0, 1, .2));
|
patch.set_color(vhi, MyMesh::Color(0, 1, .2));
|
||||||
size_t i = vhi.idx();
|
size_t i = vhi.idx();
|
||||||
size_t x = i % patch_divs;
|
size_t x = i % patch_divs;
|
||||||
size_t y = 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;
|
if (x == patch_divs - 1 || y == patch_divs - 1) continue;
|
||||||
|
|
||||||
patch.add_face(vhi, patch.vertex_handle(i + patch_divs),
|
patch.add_face(vhi, patch.vertex_handle(i + patch_divs),
|
||||||
patch.vertex_handle(i + 1));
|
patch.vertex_handle(i + 1));
|
||||||
patch.add_face(patch.vertex_handle(i + 1),
|
patch.add_face(patch.vertex_handle(i + 1),
|
||||||
|
Loading…
Reference in New Issue
Block a user