TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
G3D::KDTree< T, BoundsFunc, HashFunc, EqualsFunc >::Handle Class Reference

#include <KDTree.h>

Public Member Functions

 Handle ()
 
 Handle (const T &v)
 
bool operator== (const Handle &other) const
 
size_t hashCode () const
 

Public Attributes

AABox bounds
 
Vector3 center
 
value
 

Detailed Description

template<class T, class BoundsFunc = BoundsTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
class G3D::KDTree< T, BoundsFunc, HashFunc, EqualsFunc >::Handle

Wrapper for a value that includes a cache of its bounds. Except for the test value used in a set-query operation, there is only ever one instance of the handle associated with any value and the memberTable and Nodes maintain pointers to that heap-allocated value.

Constructor & Destructor Documentation

template<class T , class BoundsFunc = BoundsTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
G3D::KDTree< T, BoundsFunc, HashFunc, EqualsFunc >::Handle::Handle ( )
inline
216 {}
template<class T , class BoundsFunc = BoundsTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
G3D::KDTree< T, BoundsFunc, HashFunc, EqualsFunc >::Handle::Handle ( const T &  v)
inline
218  : value(v) {
219  BoundsFunc::getBounds(v, bounds);
221  center = bounds.center();
222  }
AABox intersect(const AABox &other) const
Definition: AABox.h:282
T value
Definition: KDTree.h:214
Point3 center() const
Definition: AABox.h:163
AABox bounds
Definition: KDTree.h:206
static const AABox & large()
Definition: AABox.cpp:74
Vector3 center
Definition: KDTree.h:212

+ Here is the call graph for this function:

Member Function Documentation

template<class T , class BoundsFunc = BoundsTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
size_t G3D::KDTree< T, BoundsFunc, HashFunc, EqualsFunc >::Handle::hashCode ( ) const
inline
228  {
229  return HashFunc::hashCode(value);
230  }
size_t hashCode() const
Definition: Vector2unorm16.h:76
T value
Definition: KDTree.h:214

+ Here is the call graph for this function:

template<class T , class BoundsFunc = BoundsTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
bool G3D::KDTree< T, BoundsFunc, HashFunc, EqualsFunc >::Handle::operator== ( const Handle other) const
inline
224  {
225  return EqualsFunc::equals(value, other.value);
226  }
T value
Definition: KDTree.h:214

Member Data Documentation

template<class T , class BoundsFunc = BoundsTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
AABox G3D::KDTree< T, BoundsFunc, HashFunc, EqualsFunc >::Handle::bounds

The bounds of each object are constrained to AABox::large

template<class T , class BoundsFunc = BoundsTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
Vector3 G3D::KDTree< T, BoundsFunc, HashFunc, EqualsFunc >::Handle::center

Center of bounds. We cache this value to avoid recomputing it during the median sort, and because MSVC 6 std::sort goes into an infinite loop if we compute the midpoint on the fly (possibly a floating point roundoff issue, where B<A and A<B both are true).

template<class T , class BoundsFunc = BoundsTrait<T>, class HashFunc = HashTrait<T>, class EqualsFunc = EqualsTrait<T>>
T G3D::KDTree< T, BoundsFunc, HashFunc, EqualsFunc >::Handle::value

The documentation for this class was generated from the following file: