Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::SimpleKDNode< _PointType, _DataRecord > Struct Template Reference

Simple kd-tree node for use with PointKDTree. More...

#include <mitsuba/core/kdtree.h>

Public Types

enum  { ELeafFlag = 0x10, EAxisMask = 0x0F }
 
typedef _PointType PointType
 
typedef _DataRecord DataRecord
 
typedef uint32_t IndexType
 
typedef PointType::Scalar Scalar
 

Public Member Functions

 SimpleKDNode ()
 Initialize a KD-tree node. More...
 
 SimpleKDNode (const DataRecord &data)
 Initialize a KD-tree node with the given data record. More...
 
IndexType getRightIndex (IndexType self) const
 Given the current node's index, return the index of the right child. More...
 
void setRightIndex (IndexType self, IndexType value)
 Given the current node's index, set the right child index. More...
 
IndexType getLeftIndex (IndexType self) const
 Given the current node's index, return the index of the left child. More...
 
void setLeftIndex (IndexType self, IndexType value)
 Given the current node's index, set the left child index. More...
 
bool isLeaf () const
 Check whether this is a leaf node. More...
 
void setLeaf (bool value)
 Specify whether this is a leaf node. More...
 
uint16_t getAxis () const
 Return the split axis associated with this node. More...
 
void setAxis (uint8_t axis)
 Set the split flags associated with this node. More...
 
const PointTypegetPosition () const
 Return the position associated with this node. More...
 
void setPosition (const PointType &value)
 Set the position associated with this node. More...
 
DataRecordgetData ()
 Return the data record associated with this node. More...
 
const DataRecordgetData () const
 Return the data record associated with this node (const version) More...
 
void setData (const DataRecord &val)
 Set the data record associated with this node. More...
 

Public Attributes

PointType position
 
IndexType right
 
DataRecord data
 
uint8_t flags
 

Static Public Attributes

static const bool leftBalancedLayout = false
 

Detailed Description

template<typename _PointType, typename _DataRecord>
struct mitsuba::SimpleKDNode< _PointType, _DataRecord >

Simple kd-tree node for use with PointKDTree.

This class is an example of how one might write a space-efficient kd-tree node that is compatible with the PointKDTree class. The implementation supports associating a custom data record with each node and works up to 16 dimensions.

Template Parameters
_PointTypeUnderlying point data type (e.g. TPoint3<float>)
_DataRecordCustom storage that should be associated with each tree node
See Also
PointKDTree
LeftBalancedKDNode

Member Typedef Documentation

template<typename _PointType, typename _DataRecord>
typedef _DataRecord mitsuba::SimpleKDNode< _PointType, _DataRecord >::DataRecord
template<typename _PointType, typename _DataRecord>
typedef uint32_t mitsuba::SimpleKDNode< _PointType, _DataRecord >::IndexType
template<typename _PointType, typename _DataRecord>
typedef _PointType mitsuba::SimpleKDNode< _PointType, _DataRecord >::PointType
template<typename _PointType, typename _DataRecord>
typedef PointType::Scalar mitsuba::SimpleKDNode< _PointType, _DataRecord >::Scalar

Member Enumeration Documentation

template<typename _PointType, typename _DataRecord>
anonymous enum
Enumerator
ELeafFlag 
EAxisMask 

Constructor & Destructor Documentation

template<typename _PointType, typename _DataRecord>
mitsuba::SimpleKDNode< _PointType, _DataRecord >::SimpleKDNode ( )
inline

Initialize a KD-tree node.

template<typename _PointType, typename _DataRecord>
mitsuba::SimpleKDNode< _PointType, _DataRecord >::SimpleKDNode ( const DataRecord data)
inline

Initialize a KD-tree node with the given data record.

Member Function Documentation

template<typename _PointType, typename _DataRecord>
uint16_t mitsuba::SimpleKDNode< _PointType, _DataRecord >::getAxis ( ) const
inline

Return the split axis associated with this node.

template<typename _PointType, typename _DataRecord>
DataRecord& mitsuba::SimpleKDNode< _PointType, _DataRecord >::getData ( )
inline

Return the data record associated with this node.

template<typename _PointType, typename _DataRecord>
const DataRecord& mitsuba::SimpleKDNode< _PointType, _DataRecord >::getData ( ) const
inline

Return the data record associated with this node (const version)

template<typename _PointType, typename _DataRecord>
IndexType mitsuba::SimpleKDNode< _PointType, _DataRecord >::getLeftIndex ( IndexType  self) const
inline

Given the current node's index, return the index of the left child.

template<typename _PointType, typename _DataRecord>
const PointType& mitsuba::SimpleKDNode< _PointType, _DataRecord >::getPosition ( ) const
inline

Return the position associated with this node.

template<typename _PointType, typename _DataRecord>
IndexType mitsuba::SimpleKDNode< _PointType, _DataRecord >::getRightIndex ( IndexType  self) const
inline

Given the current node's index, return the index of the right child.

template<typename _PointType, typename _DataRecord>
bool mitsuba::SimpleKDNode< _PointType, _DataRecord >::isLeaf ( ) const
inline

Check whether this is a leaf node.

template<typename _PointType, typename _DataRecord>
void mitsuba::SimpleKDNode< _PointType, _DataRecord >::setAxis ( uint8_t  axis)
inline

Set the split flags associated with this node.

template<typename _PointType, typename _DataRecord>
void mitsuba::SimpleKDNode< _PointType, _DataRecord >::setData ( const DataRecord val)
inline

Set the data record associated with this node.

template<typename _PointType, typename _DataRecord>
void mitsuba::SimpleKDNode< _PointType, _DataRecord >::setLeaf ( bool  value)
inline

Specify whether this is a leaf node.

template<typename _PointType, typename _DataRecord>
void mitsuba::SimpleKDNode< _PointType, _DataRecord >::setLeftIndex ( IndexType  self,
IndexType  value 
)
inline

Given the current node's index, set the left child index.

template<typename _PointType, typename _DataRecord>
void mitsuba::SimpleKDNode< _PointType, _DataRecord >::setPosition ( const PointType value)
inline

Set the position associated with this node.

template<typename _PointType, typename _DataRecord>
void mitsuba::SimpleKDNode< _PointType, _DataRecord >::setRightIndex ( IndexType  self,
IndexType  value 
)
inline

Given the current node's index, set the right child index.

Member Data Documentation

template<typename _PointType, typename _DataRecord>
DataRecord mitsuba::SimpleKDNode< _PointType, _DataRecord >::data
template<typename _PointType, typename _DataRecord>
uint8_t mitsuba::SimpleKDNode< _PointType, _DataRecord >::flags
template<typename _PointType, typename _DataRecord>
const bool mitsuba::SimpleKDNode< _PointType, _DataRecord >::leftBalancedLayout = false
static
template<typename _PointType, typename _DataRecord>
PointType mitsuba::SimpleKDNode< _PointType, _DataRecord >::position
template<typename _PointType, typename _DataRecord>
IndexType mitsuba::SimpleKDNode< _PointType, _DataRecord >::right

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