WIP on pillar grouping

This commit is contained in:
tamasmeszaros 2022-11-11 16:54:53 +01:00
parent d3a2f11e29
commit 5f63b4496d
4 changed files with 11 additions and 8 deletions

View File

@ -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

View File

@ -198,6 +198,9 @@ PointCloud::PointCloud(std::vector<Node> meshpts,
for (size_t i = 0; i < m_leafs.size(); ++i) {
Node &n = m_leafs[i];
n.id = int(LEAFS_BEGIN + i);
n.left = Node::ID_NONE;
n.right = Node::ID_NONE;
m_ktree.insert({n.pos, n.id});
}
}

View File

@ -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<branchingtree::Node> 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);
}

View File

@ -629,7 +629,7 @@ std::optional<Head> calculate_pinhead_placement(Ex policy,
};
if (optimize_pinhead_placement(policy, sm, head)) {
head.id = suppt_idx;
head.id = long(suppt_idx);
return head;
}