Fix AABB query in hollowing print step

This commit is contained in:
tamasmeszaros 2022-05-09 14:13:12 +02:00
parent fed317f27b
commit bbf398f2dc
2 changed files with 8 additions and 8 deletions

View File

@ -828,22 +828,22 @@ struct Intersecting<Eigen::AlignedBox<CoordType, NumD>> {
template<class G> auto intersecting(const G &g) { return Intersecting<G>{g}; } template<class G> auto intersecting(const G &g) { return Intersecting<G>{g}; }
template<class G> struct Containing {}; template<class G> struct Within {};
// Intersection predicate specialization for box-box intersections // Intersection predicate specialization for box-box intersections
template<class CoordType, int NumD> template<class CoordType, int NumD>
struct Containing<Eigen::AlignedBox<CoordType, NumD>> { struct Within<Eigen::AlignedBox<CoordType, NumD>> {
Eigen::AlignedBox<CoordType, NumD> box; Eigen::AlignedBox<CoordType, NumD> box;
Containing(const Eigen::AlignedBox<CoordType, NumD> &bb): box{bb} {} Within(const Eigen::AlignedBox<CoordType, NumD> &bb): box{bb} {}
bool operator() (const typename Tree<NumD, CoordType>::Node &node) const bool operator() (const typename Tree<NumD, CoordType>::Node &node) const
{ {
return box.contains(node.bbox); return node.is_leaf() ? box.contains(node.bbox) : box.intersects(node.bbox);
} }
}; };
template<class G> auto containing(const G &g) { return Containing<G>{g}; } template<class G> auto within(const G &g) { return Within<G>{g}; }
namespace detail { namespace detail {
@ -858,7 +858,7 @@ void traverse_recurse(const Tree<Dims, T> &tree,
if (!pred(tree.node(idx))) return; if (!pred(tree.node(idx))) return;
if (tree.node(idx).is_leaf()) { if (tree.node(idx).is_leaf()) {
callback(tree.node(idx).idx); callback(tree.node(idx));
} else { } else {
// call this with left and right node idx: // call this with left and right node idx:

View File

@ -408,9 +408,9 @@ void SLAPrint::Steps::drill_holes(SLAPrintObject &po)
AABBTreeIndirect::traverse( AABBTreeIndirect::traverse(
tree, tree,
AABBTreeIndirect::intersecting(ebb), AABBTreeIndirect::intersecting(ebb),
[&part_to_drill, &hollowed_mesh](size_t faceid) [&part_to_drill, &hollowed_mesh](const auto& node)
{ {
part_to_drill.indices.emplace_back(hollowed_mesh.its.indices[faceid]); part_to_drill.indices.emplace_back(hollowed_mesh.its.indices[node.idx]);
}); });
auto cgal_meshpart = MeshBoolean::cgal::triangle_mesh_to_cgal( auto cgal_meshpart = MeshBoolean::cgal::triangle_mesh_to_cgal(