diff options
author | Vojtech Bubnik <bubnikv@gmail.com> | 2020-09-17 19:39:28 +0300 |
---|---|---|
committer | Vojtech Bubnik <bubnikv@gmail.com> | 2020-09-17 19:39:28 +0300 |
commit | 37c5fe9923c1bd577c6e9871a04a460a13a2f1f8 (patch) | |
tree | 5450b9b5cb3769ca961f155498e712d7169b680e /src/admesh | |
parent | acdd5716bd55dc08b5bf7b03c956f732f727c9b3 (diff) |
Refactoring of adaptive cubic / support cubic:
1) Octree is built directly from the triangle mesh by checking
overlap of a triangle with an octree cell. This shall produce
a tighter octree with less dense cells.
2) The same method is used for both the adaptive / support cubic infill,
where for the support cubic infill the non-overhang triangles are
ignored.
The AABB tree is no more used.
3) Optimized extraction of continuous infill lines in O(1) instead of O(n^2)
Diffstat (limited to 'src/admesh')
-rw-r--r-- | src/admesh/stl.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/admesh/stl.h b/src/admesh/stl.h index 9224b0459..e0f2865f0 100644 --- a/src/admesh/stl.h +++ b/src/admesh/stl.h @@ -255,18 +255,24 @@ extern void its_transform(indexed_triangle_set &its, T *trafo3x4) } template<typename T> -inline void its_transform(indexed_triangle_set &its, const Eigen::Transform<T, 3, Eigen::Affine, Eigen::DontAlign>& t) +inline void its_transform(indexed_triangle_set &its, const Eigen::Transform<T, 3, Eigen::Affine, Eigen::DontAlign>& t, bool fix_left_handed = false) { //const Eigen::Matrix<double, 3, 3, Eigen::DontAlign> r = t.matrix().template block<3, 3>(0, 0); for (stl_vertex &v : its.vertices) v = (t * v.template cast<T>()).template cast<float>().eval(); + if (fix_left_handed && t.matrix().block(0, 0, 3, 3).determinant() < 0.) + for (stl_triangle_vertex_indices &i : its.indices) + std::swap(i[0], i[1]); } template<typename T> -inline void its_transform(indexed_triangle_set &its, const Eigen::Matrix<T, 3, 3, Eigen::DontAlign>& m) +inline void its_transform(indexed_triangle_set &its, const Eigen::Matrix<T, 3, 3, Eigen::DontAlign>& m, bool fix_left_handed = false) { - for (stl_vertex &v : its.vertices) + for (stl_vertex &v : its.vertices) v = (m * v.template cast<T>()).template cast<float>().eval(); + if (fix_left_handed && m.determinant() < 0.) + for (stl_triangle_vertex_indices &i : its.indices) + std::swap(i[0], i[1]); } extern void its_rotate_x(indexed_triangle_set &its, float angle); |