Fix of paint on supports don't work for object that has been scaled up #6718

The triangle-ray intersection function used a hard coded epsilon,
which did not work for triangle meshes, that were either too small
or too large. Newly the epsilon may be provided to the AABBTreeIndirect
search functions externally and IndexedMesh calculates a suitable
epsilon on demand from an average triangle mesh edge length.
This commit is contained in:
Vojtech Bubnik 2021-08-27 21:04:11 +02:00
parent d9f2fd7501
commit 1c76df89ea
6 changed files with 127 additions and 50 deletions

View file

@ -42,12 +42,14 @@ class IndexedMesh {
std::vector<DrainHole> m_holes;
#endif
template<class M> void init(const M &mesh);
template<class M> void init(const M &mesh, bool calculate_epsilon);
public:
explicit IndexedMesh(const indexed_triangle_set&);
explicit IndexedMesh(const TriangleMesh &mesh);
// calculate_epsilon ... calculate epsilon for triangle-ray intersection from an average triangle edge length.
// If set to false, a default epsilon is used, which works for "reasonable" meshes.
explicit IndexedMesh(const indexed_triangle_set &tmesh, bool calculate_epsilon = false);
explicit IndexedMesh(const TriangleMesh &mesh, bool calculate_epsilon = false);
IndexedMesh(const IndexedMesh& other);
IndexedMesh& operator=(const IndexedMesh&);