Tramway SDK
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
tram::Octree< T > Class Template Reference

#include <octree.h>

Classes

struct  NearestSearch
 
struct  Node
 

Public Member Functions

 Octree (std::string name, size_t size)
 
uint32_t Insert (vec3 point, T data)
 
void Remove (uint32_t node)
 
size_t Find (T *array, vec3 point)
 
void Draw ()
 
uint32_t AddLeaf (T type, float x, float y, float z)
 
void RemoveLeaf (uint32_t leaf_id)
 
size_t FindNearest (T result[], float x, float y, float z)
 

Protected Types

enum  Octant {
  OCTANT_TOP_LEFT_BACK , OCTANT_TOP_LEFT_FRONT , OCTANT_TOP_RIGHT_BACK , OCTANT_TOP_RIGHT_FRONT ,
  OCTANT_BOTTOM_LEFT_BACK , OCTANT_BOTTOM_LEFT_FRONT , OCTANT_BOTTOM_RIGHT_BACK , OCTANT_BOTTOM_RIGHT_FRONT
}
 

Protected Member Functions

void Insert (Node *parent, Node *leaf)
 
void Remove (Node *node)
 
void FindNearest (NearestSearch *search, Node *parent_node)
 
void FindNearest (NearestSearch *search, Node *parent_node, int octant)
 
NodeNewNode (Octant octant, Node *parent)
 
Octant GetOctant (vec3 mid, vec3 point)
 
void Draw (Node *node)
 

Protected Attributes

Pool< Nodenodes
 
Noderoot = nullptr
 

Member Enumeration Documentation

◆ Octant

template<typename T >
enum tram::Octree::Octant
protected
Enumerator
OCTANT_TOP_LEFT_BACK 
OCTANT_TOP_LEFT_FRONT 
OCTANT_TOP_RIGHT_BACK 
OCTANT_TOP_RIGHT_FRONT 
OCTANT_BOTTOM_LEFT_BACK 
OCTANT_BOTTOM_LEFT_FRONT 
OCTANT_BOTTOM_RIGHT_BACK 
OCTANT_BOTTOM_RIGHT_FRONT 

Constructor & Destructor Documentation

◆ Octree()

template<typename T >
tram::Octree< T >::Octree ( std::string  name,
size_t  size 
)
inline

Member Function Documentation

◆ AddLeaf()

template<typename T >
uint32_t tram::Octree< T >::AddLeaf ( type,
float  x,
float  y,
float  z 
)
inline

◆ Draw() [1/2]

template<typename T >
void tram::Octree< T >::Draw ( )
inline

◆ Draw() [2/2]

template<typename T >
void tram::Octree< T >::Draw ( Node node)
inlineprotected

◆ Find()

template<typename T >
size_t tram::Octree< T >::Find ( T *  array,
vec3  point 
)
inline

◆ FindNearest() [1/3]

template<typename T >
void tram::Octree< T >::FindNearest ( NearestSearch search,
Node parent_node 
)
inlineprotected

◆ FindNearest() [2/3]

template<typename T >
void tram::Octree< T >::FindNearest ( NearestSearch search,
Node parent_node,
int  octant 
)
inlineprotected

◆ FindNearest() [3/3]

template<typename T >
size_t tram::Octree< T >::FindNearest ( result[],
float  x,
float  y,
float  z 
)
inline

◆ GetOctant()

template<typename T >
Octant tram::Octree< T >::GetOctant ( vec3  mid,
vec3  point 
)
inlineprotected

◆ Insert() [1/2]

template<typename T >
void tram::Octree< T >::Insert ( Node parent,
Node leaf 
)
inlineprotected

◆ Insert() [2/2]

template<typename T >
uint32_t tram::Octree< T >::Insert ( vec3  point,
data 
)
inline

◆ NewNode()

template<typename T >
Node * tram::Octree< T >::NewNode ( Octant  octant,
Node parent 
)
inlineprotected

◆ Remove() [1/2]

template<typename T >
void tram::Octree< T >::Remove ( Node node)
inlineprotected

◆ Remove() [2/2]

template<typename T >
void tram::Octree< T >::Remove ( uint32_t  node)
inline

◆ RemoveLeaf()

template<typename T >
void tram::Octree< T >::RemoveLeaf ( uint32_t  leaf_id)
inline

Member Data Documentation

◆ nodes

template<typename T >
Pool<Node> tram::Octree< T >::nodes
protected

◆ root

template<typename T >
Node* tram::Octree< T >::root = nullptr
protected

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