lower the quadratic patch resolution
This commit is contained in:
parent
c97e80929e
commit
1d1f2c22f7
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
MyMesh tesselate_quad_patch(QuadPatch q, MyMesh mesh, VertexHandle vh) {
|
MyMesh tesselate_quad_patch(QuadPatch q, MyMesh mesh, VertexHandle vh) {
|
||||||
|
const size_t patch_divs = 8;
|
||||||
MyMesh patch;
|
MyMesh patch;
|
||||||
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]);
|
||||||
@ -17,10 +18,10 @@ 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]);
|
||||||
}
|
}
|
||||||
double xstep = (xmax-xmin)/64.;
|
double xstep = (xmax-xmin)/static_cast<double>(patch_divs);
|
||||||
double ystep = (ymax-ymin)/64.;
|
double ystep = (ymax-ymin)/static_cast<double>(patch_divs);
|
||||||
for (size_t y = 0; y < 64; y++) {
|
for (size_t y = 0; y < patch_divs; y++) {
|
||||||
for (size_t x = 0; x < 64; x++) {
|
for (size_t x = 0; x < patch_divs; x++) {
|
||||||
double dx = xmin + x * xstep;
|
double dx = xmin + x * xstep;
|
||||||
double dy = ymin + y * ystep;
|
double dy = ymin + y * ystep;
|
||||||
Eigen::Vector3d point(dx, dy, -q(dx, dy));
|
Eigen::Vector3d point(dx, dy, -q(dx, dy));
|
||||||
@ -31,14 +32,14 @@ MyMesh tesselate_quad_patch(QuadPatch q, MyMesh mesh, VertexHandle vh) {
|
|||||||
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 % 64;
|
size_t x = i % patch_divs;
|
||||||
size_t y = i / 64;
|
size_t y = i / patch_divs;
|
||||||
if (x == 63 || y == 63) continue;
|
if (x == patch_divs - 1 || y == patch_divs - 1) continue;
|
||||||
patch.add_face(vhi, patch.vertex_handle(i + 64),
|
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),
|
||||||
patch.vertex_handle(i + 64),
|
patch.vertex_handle(i + patch_divs),
|
||||||
patch.vertex_handle(i + 65));
|
patch.vertex_handle(i + patch_divs + 1));
|
||||||
}
|
}
|
||||||
return patch;
|
return patch;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user