WIP TreeSupports:

1) Reworked the merging code to use an AABB tree for better locality.
   The old code sorted lexicographically, the new code splits bounding
   boxes by the longest axis.
2) Refactored to a functional style with better const correctness.
3) Reduced memory allocation pressure by replacing std::set with
   vectors, in place merging etc.
This commit is contained in:
Vojtech Bubnik 2022-09-26 11:20:00 +02:00
parent 87dcba3e30
commit 2b3d4b2868
6 changed files with 1741 additions and 1676 deletions

View file

@ -83,6 +83,13 @@ public:
// to split around.
template<typename SourceNode>
void build(std::vector<SourceNode> &&input)
{
this->build_modify_input(input);
input.clear();
}
template<typename SourceNode>
void build_modify_input(std::vector<SourceNode> &input)
{
if (input.empty())
clear();
@ -91,7 +98,6 @@ public:
m_nodes.assign(next_highest_power_of_2(input.size()) * 2 - 1, Node());
build_recursive(input, 0, 0, input.size() - 1);
}
input.clear();
}
const std::vector<Node>& nodes() const { return m_nodes; }