TriangleSelector:

1) Fixing yesterday's regression in deserialization of older painted 3MFs
   (order of triangle children is now reversed, thus the serialization
    / deserialization has to take it into account).
2) WIP extraction into facets to triangulate T-joints.
This commit is contained in:
Vojtech Bubnik 2021-06-16 10:52:00 +02:00
parent ccb53f71b6
commit d0411223be
2 changed files with 218 additions and 18 deletions

View file

@ -43,8 +43,13 @@ public:
int facet_start, // facet of the original mesh (unsplit) that the hit point belongs to
float seed_fill_angle); // the maximal angle between two facets to be painted by the same color
// Get facets currently in the given state.
bool has_facets(EnforcerBlockerType state) const;
static bool has_facets(const std::pair<std::vector<std::pair<int, int>>, std::vector<bool>> &data, const EnforcerBlockerType test_state);
int num_facets(EnforcerBlockerType state) const;
// Get facets at a given state. Don't triangulate T-joints.
indexed_triangle_set get_facets(EnforcerBlockerType state) const;
// Get facets at a given state. Triangulate T-joints.
indexed_triangle_set get_facets_strict(EnforcerBlockerType state) const;
// Set facet of the mesh to a given state. Only works for original triangles.
void set_facet(int facet_idx, EnforcerBlockerType state);
@ -204,6 +209,13 @@ private:
bool verify_triangle_midpoints(const Triangle& tr) const;
#endif // _NDEBUG
void get_facets_strict_recursive(
const Triangle &tr,
const Vec3i &neighbors,
EnforcerBlockerType state,
std::vector<stl_triangle_vertex_indices> &out_triangles) const;
void get_facets_split_by_tjoints(const Vec3i vertices, const Vec3i neighbors, std::vector<stl_triangle_vertex_indices> &out_triangles) const;
int m_free_triangles_head { -1 };
int m_free_vertices_head { -1 };
};