#include <PointKDTree.h>
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
Creates node with NULL children
180 for (
int i = 0; i < 2; ++i) {
Definition: Vector3.h:122
float splitLocation
Definition: PointKDTree.h:159
arena_t NULL
Definition: jemalloc_internal.h:624
Node * child[2]
Definition: PointKDTree.h:170
Vector3::Axis splitAxis
Definition: PointKDTree.h:156
static const Vector3 & inf()
Definition: Vector3.cpp:124
AABox splitBounds
Definition: PointKDTree.h:154
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
Doesn't clone children.
192 for (
int i = 0; i < 2; ++i) {
float splitLocation
Definition: PointKDTree.h:159
arena_t NULL
Definition: jemalloc_internal.h:624
Node * child[2]
Definition: PointKDTree.h:170
Vector3::Axis splitAxis
Definition: PointKDTree.h:156
Array< Handle > valueArray
Definition: PointKDTree.h:173
AABox splitBounds
Definition: PointKDTree.h:154
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
Copies the specified subarray of pt into point, NULLs the children. Assumes a second pass will set splitBounds.
202 for (
int i = 0; i < 2; ++i) {
Definition: Vector3.h:122
float splitLocation
Definition: PointKDTree.h:159
arena_t NULL
Definition: jemalloc_internal.h:624
Node * child[2]
Definition: PointKDTree.h:170
Vector3::Axis splitAxis
Definition: PointKDTree.h:156
Array< Handle > valueArray
Definition: PointKDTree.h:173
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
Deletes the children (but not the values)
211 for (
int i = 0; i < 2; ++i) {
Node * child[2]
Definition: PointKDTree.h:170
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
Recurse through the tree, assigning splitBounds fields.
407 AABox childBounds[2];
410 for (
int c = 0; c < 2; ++c) {
float splitLocation
Definition: PointKDTree.h:159
const Point3 & low() const
Definition: AABox.h:136
#define debugAssert(exp)
Definition: debugAssert.h:160
Node * child[2]
Definition: PointKDTree.h:170
Vector3::Axis splitAxis
Definition: PointKDTree.h:156
const Point3 & high() const
Definition: AABox.h:141
void assignSplitBounds(const AABox &myBounds)
Definition: PointKDTree.h:397
AABox splitBounds
Definition: PointKDTree.h:154
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
Clears the member table
292 if (bi.readUInt8() == 0) {
296 n->splitBounds.deserialize(bi);
298 n->splitLocation = bi.readFloat32();
299 for (
int c = 0; c < 2; ++c) {
static Node * deserializeStructure(BinaryInput &bi)
Definition: PointKDTree.h:291
arena_t NULL
Definition: jemalloc_internal.h:624
void deserialize(std::string &s, BinaryInput &b)
Definition: serialize.h:16
Node()
Definition: PointKDTree.h:176
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
Returns the deepest node that completely contains bounds.
Node * findDeepestContainingNode(const Vector3 &point)
Definition: PointKDTree.h:307
float splitLocation
Definition: PointKDTree.h:159
arena_t NULL
Definition: jemalloc_internal.h:624
Node * child[2]
Definition: PointKDTree.h:170
Vector3::Axis splitAxis
Definition: PointKDTree.h:156
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
Recursively appends all handles and children's handles to the array.
229 for (
int i = 0; i < 2; ++i) {
arena_t NULL
Definition: jemalloc_internal.h:624
void getHandles(Array< Handle > &handleArray) const
Definition: PointKDTree.h:227
Node * child[2]
Definition: PointKDTree.h:170
Array< Handle > valueArray
Definition: PointKDTree.h:173
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
Appends all members that intersect the box. If useSphere is true, members are tested against the sphere instead.
339 const Handle* handleArray =
valueArray.getCArray();
341 const float r2 =
square(sphere.radius);
344 const Vector3 center = sphere.center;
345 for (
int v = 0; v < N; ++v) {
346 if ((center - handleArray[v].position()).squaredLength() <= r2) {
float splitLocation
Definition: PointKDTree.h:159
void getIntersectingMembers(const AABox &sphereBounds, const Sphere &sphere, Array< T > &members) const
Definition: PointKDTree.h:331
double square(double fValue)
Definition: g3dmath.h:698
Node * child[2]
Definition: PointKDTree.h:170
Vector3::Axis splitAxis
Definition: PointKDTree.h:156
const FieldDescriptor value
Definition: descriptor.h:1522
void append(const T &value)
Definition: Array.h:583
Array< Handle > valueArray
Definition: PointKDTree.h:173
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
Appends all members that intersect the box. If useSphere is true, members are tested against the sphere instead.
Implemented using both box and sphere tests to simplify the implementation of a future beginSphereInteresection iterator using the same underlying BoxIterator class.
377 if ((useSphere && sphere.contains(
valueArray[v].position())) ||
378 (! useSphere && box.contains(
valueArray[v].position()))) {
float splitLocation
Definition: PointKDTree.h:159
arena_t NULL
Definition: jemalloc_internal.h:624
void getIntersectingMembers(const AABox &sphereBounds, const Sphere &sphere, Array< T > &members) const
Definition: PointKDTree.h:331
Node * child[2]
Definition: PointKDTree.h:170
Vector3::Axis splitAxis
Definition: PointKDTree.h:156
const FieldDescriptor value
Definition: descriptor.h:1522
void append(const T &value)
Definition: Array.h:583
Array< Handle > valueArray
Definition: PointKDTree.h:173
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
Returns true if this node is a leaf (no children)
arena_t NULL
Definition: jemalloc_internal.h:624
Node * child[2]
Definition: PointKDTree.h:170
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
Stores the locations of the splitting planes (the structure but not the content) so that the tree can be quickly rebuilt from a previous configuration without calling balance.
281 n->splitBounds.serialize(bo);
283 bo.writeFloat32(n->splitLocation);
284 for (
int c = 0; c < 2; ++c) {
static void serializeStructure(const Node *n, BinaryOutput &bo)
Definition: PointKDTree.h:276
arena_t NULL
Definition: jemalloc_internal.h:624
void serialize(const std::string &s, BinaryOutput &b)
Definition: serialize.h:12
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
245 for (
int i = 0; i <
valueArray.length(); ++i) {
float splitLocation
Definition: PointKDTree.h:159
bool contains(const AABox &other) const
Definition: AABox.h:238
arena_t NULL
Definition: jemalloc_internal.h:624
const Point3 & low() const
Definition: AABox.h:136
#define debugAssert(exp)
Definition: debugAssert.h:160
Node * child[2]
Definition: PointKDTree.h:170
Vector3::Axis splitAxis
Definition: PointKDTree.h:156
void verifyNode(const Vector3 &lo, const Vector3 &hi)
Definition: PointKDTree.h:237
const Point3 & high() const
Definition: AABox.h:141
Array< Handle > valueArray
Definition: PointKDTree.h:173
AABox splitBounds
Definition: PointKDTree.h:154
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
child[0] contains all values strictly smaller than splitLocation along splitAxis.
child[1] contains all values strictly larger.
Both may be NULL if there are not enough values to bother recursing.
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
Spatial bounds on all values at this node and its children, based purely on the parent's splitting planes. May be infinite
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
float G3D::PointKDTree< T, PositionFunc, HashFunc, EqualsFunc >::Node::splitLocation |
Location along the specified axis
template<class T , class PositionFunc = PositionTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
Values if this is a leaf node).
The documentation for this class was generated from the following file: