64 std::vector<SKDNode*> m_blocks;
67 static constexpr size_t NODE_BLOCK_SIZE = 1024;
69 core::array<SKDNode*> m_stack;
86 inline void insert(
const core::vector3df& pos,
void* data)
88 insert(pos.X, pos.Y, pos.Z, data);
98 void insert(
float x,
float y,
float z,
void* data);
114 return nearest(pos.X, pos.Y, pos.Z);
140 inline int nearestRange(
const core::vector3df& pos,
float range, core::array<SKDNode*>& outResults)
152 int nearestRange(
const float* pos,
float range, core::array<SKDNode*>& outResults);
156 SKDNode* allocNode(
float x,
float y,
float z,
void* data,
int dir);
int nearestRange(const float *pos, float range, core::array< SKDNode * > &outResults)
Find all nodes within a radius of a point.
void clear()
Remove all nodes from the tree.
int nearestRange(const core::vector3df &pos, float range, core::array< SKDNode * > &outResults)
Find all nodes within a radius of a point.
Definition CKDTree3f.h:140
SKDNode * nearest(float x, float y, float z)
Find the node nearest to a point.
SKDNode * nearest(const core::vector3df &pos)
Find the node nearest to a point.
Definition CKDTree3f.h:112
void insert(const core::vector3df &pos, void *data)
Insert a point and payload into the tree.
Definition CKDTree3f.h:86
virtual ~CKDTree3f()
Destroy the KD-tree and release all node blocks.
void insert(float x, float y, float z, void *data)
Insert a point and payload into the tree.
CKDTree3f()
Construct an empty KD-tree.
SKDNode * nearest(const float *pos)
Find the node nearest to a point.
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29
Node stored in the KD-tree.
Definition CKDTree3f.h:45
void * Data
User payload associated with the node.
Definition CKDTree3f.h:49
int Dir
Split axis used by this node: 0 = X, 1 = Y, 2 = Z.
Definition CKDTree3f.h:51
float Pos[3]
Position of the node in 3D space.
Definition CKDTree3f.h:47
SKDNode * Left
Child with smaller coordinate on Dir.
Definition CKDTree3f.h:54
SKDNode * Right
Child with greater or equal coordinate on Dir.
Definition CKDTree3f.h:56