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 /src/libslic3r/SLA | |
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 'src/libslic3r/SLA')
-rw-r--r-- | src/libslic3r/SLA/Hollowing.cpp | 6 | ||||
-rw-r--r-- | src/libslic3r/SLA/ReprojectPointsOnMesh.hpp | 1 | ||||
-rw-r--r-- | src/libslic3r/SLA/Rotfinder.cpp | 3 |
3 files changed, 1 insertions, 9 deletions
diff --git a/src/libslic3r/SLA/Hollowing.cpp b/src/libslic3r/SLA/Hollowing.cpp index 55dae9430..9cac7f63b 100644 --- a/src/libslic3r/SLA/Hollowing.cpp +++ b/src/libslic3r/SLA/Hollowing.cpp @@ -286,8 +286,6 @@ void cut_drainholes(std::vector<ExPolygons> & obj_slices, if (mesh.empty()) return; - mesh.require_shared_vertices(); - std::vector<ExPolygons> hole_slices = slice_mesh_ex(mesh.its, slicegrid, closing_radius, thr); if (obj_slices.size() != hole_slices.size()) @@ -316,7 +314,6 @@ void hollow_mesh(TriangleMesh &mesh, const Interior &interior, int flags) remove_inside_triangles(mesh, interior); mesh.merge(TriangleMesh{interior.mesh}); - mesh.require_shared_vertices(); } // Get the distance of p to the interior's zero iso_surface. Interior should @@ -557,8 +554,7 @@ void remove_inside_triangles(TriangleMesh &mesh, const Interior &interior, new_faces = {}; mesh = TriangleMesh{mesh.its}; - mesh.repaired = true; - mesh.require_shared_vertices(); + //FIXME do we want to repair the mesh? Are there duplicate vertices or flipped triangles? } }} // namespace Slic3r::sla diff --git a/src/libslic3r/SLA/ReprojectPointsOnMesh.hpp b/src/libslic3r/SLA/ReprojectPointsOnMesh.hpp index 20804193e..3ad7d62b1 100644 --- a/src/libslic3r/SLA/ReprojectPointsOnMesh.hpp +++ b/src/libslic3r/SLA/ReprojectPointsOnMesh.hpp @@ -33,7 +33,6 @@ inline void reproject_points_and_holes(ModelObject *object) if (!object || (!has_holes && !has_sppoints)) return; TriangleMesh rmsh = object->raw_mesh(); - rmsh.require_shared_vertices(); IndexedMesh emesh{rmsh}; if (has_sppoints) diff --git a/src/libslic3r/SLA/Rotfinder.cpp b/src/libslic3r/SLA/Rotfinder.cpp index 5486741f2..196646dc9 100644 --- a/src/libslic3r/SLA/Rotfinder.cpp +++ b/src/libslic3r/SLA/Rotfinder.cpp @@ -205,7 +205,6 @@ inline bool is_on_floor(const SLAPrintObjectConfig &cfg) std::vector<XYRotation> get_chull_rotations(const TriangleMesh &mesh, size_t max_count) { TriangleMesh chull = mesh.convex_hull_3d(); - chull.require_shared_vertices(); double chull2d_area = chull.convex_hull().area(); double area_threshold = chull2d_area / (scaled<double>(1e3) * scaled(1.)); @@ -299,7 +298,6 @@ struct RotfinderBoilerplate { static TriangleMesh get_mesh_to_rotate(const ModelObject &mo) { TriangleMesh mesh = mo.raw_mesh(); - mesh.require_shared_vertices(); ModelInstance *mi = mo.instances[0]; auto rotation = Vec3d::Zero(); @@ -437,7 +435,6 @@ Vec2d find_min_z_height_rotation(const ModelObject &mo, RotfinderBoilerplate<1000> bp{mo, params}; TriangleMesh chull = bp.mesh.convex_hull_3d(); - chull.require_shared_vertices(); auto inputs = reserve_vector<XYRotation>(chull.its.indices.size()); auto rotcmp = [](const XYRotation &r1, const XYRotation &r2) { double xdiff = r1[X] - r2[X], ydiff = r1[Y] - r2[Y]; |