diff options
author | Vojtech Bubnik <bubnikv@gmail.com> | 2021-09-20 18:12:22 +0300 |
---|---|---|
committer | Vojtech Bubnik <bubnikv@gmail.com> | 2021-09-20 18:12:22 +0300 |
commit | 8a2a9dba2f8f94da0106b60df613cd04ada4d595 (patch) | |
tree | 6997d6e42ad455cfcca787a514245a4fbfe0eee7 /sandboxes | |
parent | f484953a5a1fecd878242ca8d2f5175151b81678 (diff) |
Eradicated admesh from TriangleMesh:
TriangleMesh newly only holds indexed_triangle_set and
TriangleMeshStats. TriangleMeshStats contains an excerpt of stl_stats.
TriangleMeshStats are updated when initializing with indexed_triangle_set.
Admesh triangle mesh fixing is newly only used when loading an STL.
AMF / 3MF / OBJ file formats are already indexed triangle sets, thus
they are no more converted to admesh stl_file format, nor fixed
through admesh repair machinery. When importing AMF / 3MF / OBJ files,
volume is calculated and if negative, all faces are flipped. Also
a bounding box and number of open edges is calculated.
Implemented its_number_of_patches(), its_num_open_edges()
Optimized its_split(), its_is_splittable() using a visitor pattern.
Reworked QHull integration into TriangleMesh:
1) Face normals were not right.
2) Indexed triangle set is newly emitted instead of duplicating
vertices for each face.
Fixed cut_mesh(): Orient the triangulated faces correctly.
Diffstat (limited to 'sandboxes')
-rw-r--r-- | sandboxes/aabb-evaluation/aabb-evaluation.cpp | 3 | ||||
-rw-r--r-- | sandboxes/meshboolean/MeshBoolean.cpp | 1 | ||||
-rw-r--r-- | sandboxes/opencsg/Engine.cpp | 3 | ||||
-rw-r--r-- | sandboxes/opencsg/ShaderCSGDisplay.cpp | 9 |
4 files changed, 3 insertions, 13 deletions
diff --git a/sandboxes/aabb-evaluation/aabb-evaluation.cpp b/sandboxes/aabb-evaluation/aabb-evaluation.cpp index 9ec7451e5..1019ecf28 100644 --- a/sandboxes/aabb-evaluation/aabb-evaluation.cpp +++ b/sandboxes/aabb-evaluation/aabb-evaluation.cpp @@ -212,8 +212,7 @@ int main(const int argc, const char *argv[]) return -1; } - mesh.repair(); - if (mesh.facets_count() == 0) { + if (mesh.empty()) { std::cerr << "Error loading " << argv[1] << " . It is empty." << std::endl; return -1; } diff --git a/sandboxes/meshboolean/MeshBoolean.cpp b/sandboxes/meshboolean/MeshBoolean.cpp index 392d90707..c8649888f 100644 --- a/sandboxes/meshboolean/MeshBoolean.cpp +++ b/sandboxes/meshboolean/MeshBoolean.cpp @@ -24,7 +24,6 @@ int main(const int argc, const char * argv[]) TriangleMesh input; input.ReadSTLFile(argv[1]); - input.repair(); Benchmark bench; diff --git a/sandboxes/opencsg/Engine.cpp b/sandboxes/opencsg/Engine.cpp index 53e340294..d8f1d3464 100644 --- a/sandboxes/opencsg/Engine.cpp +++ b/sandboxes/opencsg/Engine.cpp @@ -409,7 +409,6 @@ void CSGDisplay::on_scene_updated(const Scene &scene) interior.transform(po->trafo().inverse()); mshinst.merge(interior); - mshinst.require_shared_vertices(); mi->transform_mesh(&mshinst); @@ -417,14 +416,12 @@ void CSGDisplay::on_scene_updated(const Scene &scene) auto center = bb.center().cast<float>(); mshinst.translate(-center); - mshinst.require_shared_vertices(); m_scene_cache.add_mesh(mshinst, OpenCSG::Intersection, m_csgsettings.get_convexity()); } for (const sla::DrainHole &holept : holedata) { TriangleMesh holemesh = sla::to_triangle_mesh(holept.to_mesh()); - holemesh.require_shared_vertices(); m_scene_cache.add_mesh(holemesh, OpenCSG::Subtraction, 1); } } diff --git a/sandboxes/opencsg/ShaderCSGDisplay.cpp b/sandboxes/opencsg/ShaderCSGDisplay.cpp index 8ceb234be..2413bad5b 100644 --- a/sandboxes/opencsg/ShaderCSGDisplay.cpp +++ b/sandboxes/opencsg/ShaderCSGDisplay.cpp @@ -43,7 +43,6 @@ void ShaderCSGDisplay::on_scene_updated(const Scene &scene) interior.transform(po->trafo().inverse()); mshinst.merge(interior); - mshinst.require_shared_vertices(); mi->transform_mesh(&mshinst); @@ -51,15 +50,11 @@ void ShaderCSGDisplay::on_scene_updated(const Scene &scene) auto center = bb.center().cast<float>(); mshinst.translate(-center); - mshinst.require_shared_vertices(); add_mesh(mshinst); } - for (const sla::DrainHole &holept : holedata) { - TriangleMesh holemesh = sla::to_triangle_mesh(holept.to_mesh()); - holemesh.require_shared_vertices(); - add_mesh(holemesh); - } + for (const sla::DrainHole &holept : holedata) + add_mesh(sla::to_triangle_mesh(holept.to_mesh())); } repaint(); |