New utility function its_merge_vertices().

Implemented contour simplification inside slice_mesh_ex().
This commit is contained in:
Vojtech Bubnik 2021-05-18 17:57:35 +02:00
parent dfc6d399f7
commit c28cd957d5
4 changed files with 83 additions and 1 deletions

View file

@ -98,10 +98,19 @@ std::vector<std::vector<size_t>> create_vertex_faces_index(const indexed_triangl
// Used for chaining slice lines into polygons.
std::vector<Vec3i> create_face_neighbors_index(const indexed_triangle_set &its);
std::vector<Vec3i> create_face_neighbors_index(const indexed_triangle_set &its, std::function<void()> throw_on_cancel_callback);
// Merge duplicate vertices, return number of vertices removed.
// This function will happily create non-manifolds if more than two faces share the same vertex position
// or more than two faces share the same edge position!
int its_merge_vertices(indexed_triangle_set &its, bool shrink_to_fit = true);
// Remove degenerate faces, return number of faces removed.
int its_remove_degenerate_faces(indexed_triangle_set &its, bool shrink_to_fit = true);
// Remove vertices, which none of the faces references. Return number of freed vertices.
int its_compactify_vertices(indexed_triangle_set &its, bool shrink_to_fit = true);
// Shrink the vectors of its.vertices and its.faces to a minimum size by reallocating the two vectors.
void its_shrink_to_fit(indexed_triangle_set &its);
TriangleMesh make_cube(double x, double y, double z);