Nori

KDTreeBase< BoundingBoxType >::KDNode Struct Reference

KD-tree node in 8 bytes. More...

#include <gkdtree.h>

List of all members.

Public Types

enum  EMask {
  ETypeMask = 1 << 31, EIndirectionMask = 1 << 30, ELeafOffsetMask = ~ETypeMask, EInnerAxisMask = 0x3,
  EInnerOffsetMask = ~(EInnerAxisMask + EIndirectionMask), ERelOffsetLimit = (1<<28) - 1
}

Public Member Functions

void initLeafNode (unsigned int offset, unsigned int numPrims)
 Initialize a leaf kd-Tree node.
bool initInnerNode (int axis, float split, ptrdiff_t relOffset)
void initIndirectionNode (int axis, float split, uint32_t indirectionEntry)
 Initialize an interior indirection node.
bool isLeaf () const
 Is this a leaf node?
bool isIndirection () const
 Is this an indirection node?
IndexType getPrimStart () const
 Assuming this is a leaf node, return the first primitive index.
IndexType getPrimEnd () const
 Assuming this is a leaf node, return the last primitive index.
IndexType getIndirectionIndex () const
 Return the index of an indirection node.
const KDNodegetLeft () const
 Return the left child (assuming that this is an interior node)
const KDNodegetSibling () const
 Return the sibling of the current node.
KDNodegetLeft ()
 Return the left child (assuming that this is an interior node)
const KDNodegetRight () const
 Return the left child (assuming that this is an interior node)
float getSplit () const
 Return the split plane location (assuming that this is an interior node)
int getAxis () const
 Return the split axis (assuming that this is an interior node)

Public Attributes

union {
   struct {
      uint32_t   combined
      float   split
 Split plane coordinate.
   }   inner
   struct {
      uint32_t   combined
      uint32_t   end
 End offset of the primitive list.
   }   leaf
}; 

Detailed Description

template<typename BoundingBoxType>
struct KDTreeBase< BoundingBoxType >::KDNode

KD-tree node in 8 bytes.

Definition at line 405 of file gkdtree.h.


Member Enumeration Documentation

template<typename BoundingBoxType>
enum KDTreeBase::KDNode::EMask
Enumerator:
ETypeMask 
EIndirectionMask 
ELeafOffsetMask 
EInnerAxisMask 
EInnerOffsetMask 
ERelOffsetLimit 

Definition at line 435 of file gkdtree.h.


Member Function Documentation

template<typename BoundingBoxType>
int KDTreeBase< BoundingBoxType >::KDNode::getAxis ( ) const [inline]

Return the split axis (assuming that this is an interior node)

Definition at line 534 of file gkdtree.h.

template<typename BoundingBoxType>
IndexType KDTreeBase< BoundingBoxType >::KDNode::getIndirectionIndex ( ) const [inline]

Return the index of an indirection node.

Definition at line 499 of file gkdtree.h.

template<typename BoundingBoxType>
const KDNode* KDTreeBase< BoundingBoxType >::KDNode::getLeft ( ) const [inline]

Return the left child (assuming that this is an interior node)

Definition at line 504 of file gkdtree.h.

template<typename BoundingBoxType>
KDNode* KDTreeBase< BoundingBoxType >::KDNode::getLeft ( ) [inline]

Return the left child (assuming that this is an interior node)

Definition at line 515 of file gkdtree.h.

template<typename BoundingBoxType>
IndexType KDTreeBase< BoundingBoxType >::KDNode::getPrimEnd ( ) const [inline]

Assuming this is a leaf node, return the last primitive index.

Definition at line 494 of file gkdtree.h.

template<typename BoundingBoxType>
IndexType KDTreeBase< BoundingBoxType >::KDNode::getPrimStart ( ) const [inline]

Assuming this is a leaf node, return the first primitive index.

Definition at line 489 of file gkdtree.h.

template<typename BoundingBoxType>
const KDNode* KDTreeBase< BoundingBoxType >::KDNode::getRight ( ) const [inline]

Return the left child (assuming that this is an interior node)

Definition at line 521 of file gkdtree.h.

template<typename BoundingBoxType>
const KDNode* KDTreeBase< BoundingBoxType >::KDNode::getSibling ( ) const [inline]

Return the sibling of the current node.

Definition at line 510 of file gkdtree.h.

template<typename BoundingBoxType>
float KDTreeBase< BoundingBoxType >::KDNode::getSplit ( ) const [inline]

Return the split plane location (assuming that this is an interior node)

Definition at line 529 of file gkdtree.h.

template<typename BoundingBoxType>
void KDTreeBase< BoundingBoxType >::KDNode::initIndirectionNode ( int  axis,
float  split,
uint32_t  indirectionEntry 
) [inline]

Initialize an interior indirection node.

Indirections are necessary whenever the children cannot be referenced using a relative pointer, which can happen when they lie in different memory chunks. In this case, the node stores an index into a globally shared pointer list.

Definition at line 470 of file gkdtree.h.

template<typename BoundingBoxType>
bool KDTreeBase< BoundingBoxType >::KDNode::initInnerNode ( int  axis,
float  split,
ptrdiff_t  relOffset 
) [inline]

Initialize an interior kd-Tree node. Reports a failure if the relative offset to the left child node is too large.

Definition at line 454 of file gkdtree.h.

template<typename BoundingBoxType>
void KDTreeBase< BoundingBoxType >::KDNode::initLeafNode ( unsigned int  offset,
unsigned int  numPrims 
) [inline]

Initialize a leaf kd-Tree node.

Definition at line 445 of file gkdtree.h.

template<typename BoundingBoxType>
bool KDTreeBase< BoundingBoxType >::KDNode::isIndirection ( ) const [inline]

Is this an indirection node?

Definition at line 484 of file gkdtree.h.

template<typename BoundingBoxType>
bool KDTreeBase< BoundingBoxType >::KDNode::isLeaf ( ) const [inline]

Is this a leaf node?

Definition at line 479 of file gkdtree.h.


Member Data Documentation

union { ... }
template<typename BoundingBoxType>
uint32_t KDTreeBase< BoundingBoxType >::KDNode::combined

Definition at line 416 of file gkdtree.h.

template<typename BoundingBoxType>
uint32_t KDTreeBase< BoundingBoxType >::KDNode::end

End offset of the primitive list.

Definition at line 431 of file gkdtree.h.

struct { ... } KDTreeBase< BoundingBoxType >::KDNode::inner
struct { ... } KDTreeBase< BoundingBoxType >::KDNode::leaf
template<typename BoundingBoxType>
float KDTreeBase< BoundingBoxType >::KDNode::split

Split plane coordinate.

Definition at line 419 of file gkdtree.h.


The documentation for this struct was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines