10 #include <AtomsUtils/Globals.h>
11 #include <AtomsUtils/AtomsMath.h>
27 AtomsMath::Vector3 pos;
34 inline unsigned int numSamples()
const {
return high - low + 1; }
36 inline bool isLeaf()
const {
return left == -1 && right == -1; }
41 unsigned int low, high;
45 KdTreePoint(
unsigned int maxSamplesPerNode = 10,
unsigned int maxDepth = 10);
51 void addSample(
const AtomsMath::Vector3 &sample,
const int value);
57 void reserve(
size_t maxNumSamples);
59 void findInRange(
const AtomsMath::Vector3& position,
const double radius, std::vector<DataType>& neighbours)
const;
61 void findSampleInRange(
const AtomsMath::Vector3& position,
const double radius, std::vector<int>& neighbours)
const;
63 bool findClosestSample(
const AtomsMath::Vector3 &searchPoint,
int &closestId,
double* maxdist =
nullptr)
const;
65 void findClosestSamples(
const AtomsMath::Vector3 &searchPoint, std::vector<std::pair<int, double>> &closestIds,
unsigned int numSamples)
const;
67 void findClosestSamples(
const AtomsMath::Vector3 &searchPoint, std::vector<std::pair<int, double>> &closestIds,
unsigned int numSamples,
double maxDistance)
const;
69 bool intersect(
const AtomsMath::Vector3& start,
const AtomsMath::Vector3& end,
const bool disableY)
const;
71 void findInRayRange(
const AtomsMath::Line3& line,
double radius, std::vector<DataType>& neighbours)
const;
73 void findSampleInRayRange(
const AtomsMath::Line3& line,
double radius, std::vector<int>& neighbours)
const;
75 inline std::vector<Sample>& samples() {
return m_samples; }
77 inline const std::vector<Sample>& samples()
const {
return m_samples; }
79 inline std::vector<int>& comb() {
return m_comb; }
81 inline std::vector<KdTreePointNode>& nodes() {
return m_nodes; }
85 void buildNode(
int nodeIndex,
const AtomsMath::Box3& box,
unsigned int depth,
int low,
int high);
87 unsigned int allocateNode();
89 void findInRangeRecurse(
unsigned int index,
const AtomsMath::Vector3& position,
const double radius, std::vector<DataType>& neighbours)
const;
91 bool intersectRecurse(
unsigned int index,
const AtomsMath::Line3d& line,
const bool disableY)
const;
93 void findSampleInRangeRecurse(
unsigned int index,
const AtomsMath::Vector3& position,
const double radius, std::vector<int>& neighbours)
const;
95 void findInRayRangeRecurse(
unsigned int index,
const AtomsMath::Line3& line,
const double radius, std::vector<DataType>& neighbours)
const;
97 void findSampleInRayRangeRecurse(
unsigned int index,
const AtomsMath::Line3& line,
const double radius, std::vector<int>& neighbours)
const;
99 void walkCells(
unsigned int cellIndex,
const AtomsMath::Vector3 &searchPoint,
int &closestId,
double& maxDist)
const;
101 void walkCells(
unsigned int cellIndex,
const AtomsMath::Vector3 &searchPoint, std::vector<std::pair<int, double>> & neighbours,
unsigned int numSamples,
double &maxDist)
const;
105 std::vector<KdTreePointNode> m_nodes;
107 std::vector<Sample> m_samples;
109 std::vector<int> m_comb;
111 unsigned int m_maxSamplesPerNode;
113 unsigned int m_maxDepth;
Definition: KdTreePoint.h:31
Definition: KdTreePoint.h:19
AtomsCore namespace.
Definition: Base64.h:13
Definition: KdTreePoint.h:25