diff options
Diffstat (limited to 'extern/carve/lib')
-rw-r--r-- | extern/carve/lib/intersect.cpp | 4 | ||||
-rw-r--r-- | extern/carve/lib/intersect_face_division.cpp | 3 | ||||
-rw-r--r-- | extern/carve/lib/mesh.cpp | 36 | ||||
-rw-r--r-- | extern/carve/lib/polyhedron.cpp | 2 |
4 files changed, 29 insertions, 16 deletions
diff --git a/extern/carve/lib/intersect.cpp b/extern/carve/lib/intersect.cpp index b92dbcfe24c..b468e4addc7 100644 --- a/extern/carve/lib/intersect.cpp +++ b/extern/carve/lib/intersect.cpp @@ -1320,8 +1320,8 @@ void carve::csg::CSG::calc(meshset_t *a, } #endif - checkFaceLoopIntegrity(a_face_loops); - checkFaceLoopIntegrity(b_face_loops); + // checkFaceLoopIntegrity(a_face_loops); + // checkFaceLoopIntegrity(b_face_loops); #if defined(CARVE_DEBUG) std::cerr << "classify" << std::endl; diff --git a/extern/carve/lib/intersect_face_division.cpp b/extern/carve/lib/intersect_face_division.cpp index c5d5d8c5152..3b771bc8f3e 100644 --- a/extern/carve/lib/intersect_face_division.cpp +++ b/extern/carve/lib/intersect_face_division.cpp @@ -1110,8 +1110,7 @@ namespace { } // copy up to the end of the path. - if (pos < e1_1) - std::copy(base_loop.begin() + pos, base_loop.begin() + e1_1, std::back_inserter(out)); + std::copy(base_loop.begin() + pos, base_loop.begin() + e1_1, std::back_inserter(out)); CARVE_ASSERT(base_loop[e1_1] == p1.back()); std::copy(p1.rbegin(), p1.rend() - 1, std::back_inserter(out)); diff --git a/extern/carve/lib/mesh.cpp b/extern/carve/lib/mesh.cpp index 55ab893c10a..ae91b385d44 100644 --- a/extern/carve/lib/mesh.cpp +++ b/extern/carve/lib/mesh.cpp @@ -243,15 +243,20 @@ namespace carve { bool FaceStitcher::EdgeOrderData::Cmp::operator()(const EdgeOrderData &a, const EdgeOrderData &b) const { int v = carve::geom3d::compareAngles(edge_dir, base_dir, a.face_dir, b.face_dir); - double da = carve::geom3d::antiClockwiseAngle(base_dir, a.face_dir, edge_dir); - double db = carve::geom3d::antiClockwiseAngle(base_dir, b.face_dir, edge_dir); - int v0 = v; - v = 0; - if (da < db) v = -1; - if (db < da) v = +1; - if (v0 != v) { - std::cerr << "v0= " << v0 << " v= " << v << " da= " << da << " db= " << db << " " << edge_dir << " " << base_dir << " " << a.face_dir << b.face_dir << std::endl; + +#if defined(CARVE_DEBUG) + { + double da = carve::geom3d::antiClockwiseAngle(base_dir, a.face_dir, edge_dir); + double db = carve::geom3d::antiClockwiseAngle(base_dir, b.face_dir, edge_dir); + int v_cmp = 0; + if (da < db) v_cmp = -1; + if (db < da) v_cmp = +1; + if (v_cmp != v) { + std::cerr << "v= " << v << " v_cmp= " << v_cmp << " da= " << da << " db= " << db << " edge_dir=" << edge_dir << " base_dir=" << base_dir << " a=" << a.face_dir << " b=" << b.face_dir << std::endl; + } } +#endif + if (v < 0) return true; if (v == 0) { if (a.is_reversed && !b.is_reversed) return true; @@ -327,9 +332,14 @@ namespace carve { CARVE_ASSERT(erev[0][i]->v2() == erev[j][i]->v2()); } - std::sort(result[i].begin(), - result[i].end(), - EdgeOrderData::Cmp(base->v2()->v - base->v1()->v, result[i][0].face_dir)); + geom::vector<3> sort_dir; + if (opts.opt_avoid_cavities) { + sort_dir = base->v1()->v - base->v2()->v; + } else { + sort_dir = base->v2()->v - base->v1()->v; + } + + std::sort(result[i].begin(), result[i].end(), EdgeOrderData::Cmp(sort_dir, result[i][0].face_dir)); } } @@ -751,11 +761,15 @@ namespace carve { } } } + + FaceStitcher::FaceStitcher(const MeshOptions &_opts) : opts(_opts) { + } } } + // construct a MeshSet from a Polyhedron, maintaining on the // connectivity information in the Polyhedron. mesh::MeshSet<3> *meshFromPolyhedron(const poly::Polyhedron *poly, int manifold_id) { diff --git a/extern/carve/lib/polyhedron.cpp b/extern/carve/lib/polyhedron.cpp index 93e667ffaf7..43d08b81bfd 100644 --- a/extern/carve/lib/polyhedron.cpp +++ b/extern/carve/lib/polyhedron.cpp @@ -233,7 +233,7 @@ namespace carve { } std::vector<mesh::Mesh<3> *> meshes; - mesh::Mesh<3>::create(mesh_faces.begin(), mesh_faces.end(), meshes); + mesh::Mesh<3>::create(mesh_faces.begin(), mesh_faces.end(), meshes, mesh::MeshOptions()); mesh::MeshSet<3> *meshset = new mesh::MeshSet<3>(vertex_storage, meshes); manifold_is_closed.resize(meshset->meshes.size()); |