diff --git a/src/libslic3r/BranchingTree/BranchingTree.hpp b/src/libslic3r/BranchingTree/BranchingTree.hpp index 3f7fd7b80..d30499c11 100644 --- a/src/libslic3r/BranchingTree/BranchingTree.hpp +++ b/src/libslic3r/BranchingTree/BranchingTree.hpp @@ -21,7 +21,7 @@ class Properties public: - constexpr bool group_pillars() const noexcept { return false; } + constexpr bool group_pillars() const noexcept { return true; } // Maximum slope for bridges of the tree Properties &max_slope(double val) noexcept diff --git a/src/libslic3r/BranchingTree/PointCloud.cpp b/src/libslic3r/BranchingTree/PointCloud.cpp index 5f07d91c7..319f334ff 100644 --- a/src/libslic3r/BranchingTree/PointCloud.cpp +++ b/src/libslic3r/BranchingTree/PointCloud.cpp @@ -197,7 +197,10 @@ PointCloud::PointCloud(std::vector meshpts, for (size_t i = 0; i < m_leafs.size(); ++i) { Node &n = m_leafs[i]; - n.id = int(LEAFS_BEGIN + i); + n.id = int(LEAFS_BEGIN + i); + n.left = Node::ID_NONE; + n.right = Node::ID_NONE; + m_ktree.insert({n.pos, n.id}); } } diff --git a/src/libslic3r/SLA/BranchingTreeSLA.cpp b/src/libslic3r/SLA/BranchingTreeSLA.cpp index fc5dc2982..2edc0fe7b 100644 --- a/src/libslic3r/SLA/BranchingTreeSLA.cpp +++ b/src/libslic3r/SLA/BranchingTreeSLA.cpp @@ -382,20 +382,20 @@ void create_branching_tree(SupportTreeBuilder &builder, const SupportableMesh &s BranchingTreeBuilder vbuilder{builder, sm, nodes}; branchingtree::build_tree(nodes, vbuilder); + std::cout << "Original pillar count: " << vbuilder.pillars().size() << std::endl; + if constexpr (props.group_pillars()) { std::vector bedleafs; - for (auto n : vbuilder.pillars()) { - n.left = branchingtree::Node::ID_NONE; - n.right = branchingtree::Node::ID_NONE; - bedleafs.emplace_back(n); - } + std::copy(vbuilder.pillars().begin(), vbuilder.pillars().end(), std::back_inserter(bedleafs)); branchingtree::PointCloud gndnodes{{}, nodes.get_bedpoints(), bedleafs, props}; BranchingTreeBuilder gndbuilder{builder, sm, gndnodes}; branchingtree::build_tree(gndnodes, gndbuilder); + std::cout << "Grouped pillar count: " << gndbuilder.pillars().size() << std::endl; build_pillars(builder, gndbuilder, sm); + } else { build_pillars(builder, vbuilder, sm); } diff --git a/src/libslic3r/SLA/SupportTreeUtils.hpp b/src/libslic3r/SLA/SupportTreeUtils.hpp index 070ffbf0d..243152189 100644 --- a/src/libslic3r/SLA/SupportTreeUtils.hpp +++ b/src/libslic3r/SLA/SupportTreeUtils.hpp @@ -629,7 +629,7 @@ std::optional calculate_pinhead_placement(Ex policy, }; if (optimize_pinhead_placement(policy, sm, head)) { - head.id = suppt_idx; + head.id = long(suppt_idx); return head; }