3D KD-tree for nearest-neighbor lookup of user data.
More...
#include <Utils/CKDTree3f.h>
|
|
| CKDTree3f () |
| | Construct an empty KD-tree.
|
|
virtual | ~CKDTree3f () |
| | Destroy the KD-tree and release all node blocks.
|
| void | insert (const core::vector3df &pos, void *data) |
| | Insert a point and payload into the tree.
|
| void | insert (float x, float y, float z, void *data) |
| | Insert a point and payload into the tree.
|
| void | clear () |
| | Remove all nodes from the tree.
|
| SKDNode * | nearest (const core::vector3df &pos) |
| | Find the node nearest to a point.
|
| SKDNode * | nearest (float x, float y, float z) |
| | Find the node nearest to a point.
|
| SKDNode * | nearest (const float *pos) |
| | Find the node nearest to a point.
|
| int | nearestRange (const core::vector3df &pos, float range, core::array< SKDNode * > &outResults) |
| | Find all nodes within a radius of a point.
|
| int | nearestRange (const float *pos, float range, core::array< SKDNode * > &outResults) |
| | Find all nodes within a radius of a point.
|
3D KD-tree for nearest-neighbor lookup of user data.
The tree stores raw void* payload pointers and does not own or delete the payloads. Nodes are allocated in fixed-size blocks and released when the tree is cleared.
◆ clear()
| void Skylicht::CKDTree3f::clear |
( |
| ) |
|
Remove all nodes from the tree.
Payload pointers are not deleted.
◆ insert() [1/2]
| void Skylicht::CKDTree3f::insert |
( |
const core::vector3df & | pos, |
|
|
void * | data ) |
|
inline |
Insert a point and payload into the tree.
- Parameters
-
| pos | Point position. |
| data | User payload pointer. Ownership remains with the caller. |
◆ insert() [2/2]
| void Skylicht::CKDTree3f::insert |
( |
float | x, |
|
|
float | y, |
|
|
float | z, |
|
|
void * | data ) |
Insert a point and payload into the tree.
- Parameters
-
| x | X coordinate. |
| y | Y coordinate. |
| z | Z coordinate. |
| data | User payload pointer. Ownership remains with the caller. |
◆ nearest() [1/3]
| SKDNode * Skylicht::CKDTree3f::nearest |
( |
const core::vector3df & | pos | ) |
|
|
inline |
Find the node nearest to a point.
- Parameters
-
- Returns
- Nearest node, or null when the tree is empty.
◆ nearest() [2/3]
| SKDNode * Skylicht::CKDTree3f::nearest |
( |
const float * | pos | ) |
|
Find the node nearest to a point.
- Parameters
-
| pos | Pointer to three floats: X, Y, Z. |
- Returns
- Nearest node, or null when the tree is empty.
◆ nearest() [3/3]
| SKDNode * Skylicht::CKDTree3f::nearest |
( |
float | x, |
|
|
float | y, |
|
|
float | z ) |
Find the node nearest to a point.
- Parameters
-
| x | Query X coordinate. |
| y | Query Y coordinate. |
| z | Query Z coordinate. |
- Returns
- Nearest node, or null when the tree is empty.
◆ nearestRange() [1/2]
| int Skylicht::CKDTree3f::nearestRange |
( |
const core::vector3df & | pos, |
|
|
float | range, |
|
|
core::array< SKDNode * > & | outResults ) |
|
inline |
Find all nodes within a radius of a point.
- Parameters
-
| pos | Query position. |
| range | Search radius. |
| outResults | Receives matching nodes sorted by distance. |
- Returns
- Number of results.
◆ nearestRange() [2/2]
| int Skylicht::CKDTree3f::nearestRange |
( |
const float * | pos, |
|
|
float | range, |
|
|
core::array< SKDNode * > & | outResults ) |
Find all nodes within a radius of a point.
- Parameters
-
| pos | Pointer to three floats: X, Y, Z. |
| range | Search radius. |
| outResults | Receives matching nodes sorted by distance. |
- Returns
- Number of results.
The documentation for this class was generated from the following file: