fix: use [0,1]x[0,1] NURBS domain
This commit is contained in:
@@ -301,13 +301,11 @@ bool write_brep_gltf(const std::string& filepath, const brep::BrepModel& model,
|
|||||||
std::vector<core::Point3D> verts;
|
std::vector<core::Point3D> verts;
|
||||||
std::vector<std::array<int, 3>> tris;
|
std::vector<std::array<int, 3>> tris;
|
||||||
|
|
||||||
auto [u_min, u_max] = surf.domain_u();
|
// NURBS domain is [0,1]×[0,1]
|
||||||
auto [v_min, v_max] = surf.domain_v();
|
|
||||||
|
|
||||||
for (int j = 0; j <= res; ++j) {
|
for (int j = 0; j <= res; ++j) {
|
||||||
double v = v_min + (v_max - v_min) * static_cast<double>(j) / res;
|
double v = static_cast<double>(j) / res;
|
||||||
for (int i = 0; i <= res; ++i) {
|
for (int i = 0; i <= res; ++i) {
|
||||||
double u = u_min + (u_max - u_min) * static_cast<double>(i) / res;
|
double u = static_cast<double>(i) / res;
|
||||||
verts.push_back(surf.evaluate(u, v));
|
verts.push_back(surf.evaluate(u, v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user