Mesh: [skip ci] add methods to create empty KD tree or to add further points
This commit is contained in:
@@ -74,6 +74,10 @@ public:
|
||||
MyKDTree kd_tree;
|
||||
};
|
||||
|
||||
MeshKDTree::MeshKDTree() : d(new Private)
|
||||
{
|
||||
}
|
||||
|
||||
MeshKDTree::MeshKDTree(const std::vector<Base::Vector3f>& points) : d(new Private)
|
||||
{
|
||||
unsigned long index=0;
|
||||
@@ -95,6 +99,28 @@ MeshKDTree::~MeshKDTree()
|
||||
delete d;
|
||||
}
|
||||
|
||||
void MeshKDTree::AddPoint(Base::Vector3f& point)
|
||||
{
|
||||
unsigned long index=d->kd_tree.size();
|
||||
d->kd_tree.insert(Point3d(point, index));
|
||||
}
|
||||
|
||||
void MeshKDTree::AddPoints(const std::vector<Base::Vector3f>& points)
|
||||
{
|
||||
unsigned long index=d->kd_tree.size();
|
||||
for (std::vector<Base::Vector3f>::const_iterator it = points.begin(); it != points.end(); ++it) {
|
||||
d->kd_tree.insert(Point3d(*it, index++));
|
||||
}
|
||||
}
|
||||
|
||||
void MeshKDTree::AddPoints(const MeshPointArray& points)
|
||||
{
|
||||
unsigned long index=d->kd_tree.size();
|
||||
for (MeshPointArray::_TConstIterator it = points.begin(); it != points.end(); ++it) {
|
||||
d->kd_tree.insert(Point3d(*it, index++));
|
||||
}
|
||||
}
|
||||
|
||||
bool MeshKDTree::IsEmpty() const
|
||||
{
|
||||
return d->kd_tree.empty();
|
||||
|
||||
@@ -32,10 +32,15 @@ namespace MeshCore
|
||||
class MeshExport MeshKDTree
|
||||
{
|
||||
public:
|
||||
MeshKDTree();
|
||||
MeshKDTree(const std::vector<Base::Vector3f>& points);
|
||||
MeshKDTree(const MeshPointArray& points);
|
||||
~MeshKDTree();
|
||||
|
||||
void AddPoint(Base::Vector3f& point);
|
||||
void AddPoints(const std::vector<Base::Vector3f>& points);
|
||||
void AddPoints(const MeshPointArray& points);
|
||||
|
||||
bool IsEmpty() const;
|
||||
void Clear();
|
||||
void Optimize();
|
||||
|
||||
Reference in New Issue
Block a user