#include <SAHKDtree.hpp>
Public Types | |
typedef std::vector < T * >::iterator | vecTIter |
typedef std::vector < TraceableEntry< T > * >::iterator | vecTEIter |
typedef std::list < PlanarEvent< T > >::iterator | listPEIter |
Public Member Functions | |
S () | |
S (std::vector< T * > *trList, int depth=40, int lSize=2) | |
virtual | ~SAHKDtree () |
Intersection | intersect (Ray &r) const |
Intersection | intersectNode (KDNode< T > *n, Ray &r) const |
const AABB & | getBoundingBox () const |
const Point3D & | getCentroid () const |
void | setTraceables (std::vector< T * > *trList) |
void | buildTree (std::vector< T * > *trList) |
KDNode< T > * | buildNode (AABB &nbox, std::vector< TraceableEntry< T > * > trList, std::list< PlanarEvent< T > > *eventList, unsigned int depth) |
KDNode< T > * | buildLeaf (std::vector< TraceableEntry< T > * > trList) |
void | createPlanarEvents (TraceableEntry< T > *trEntry, std::list< PlanarEvent< T > > *eventList, AABB tbbox) |
void | createPlanarEvents (TraceableEntry< T > *trEntry, std::list< PlanarEvent< T > > *eventList) |
float | C (float &Pl, float &Pr, int Nl, int Nr) |
float | SAH (PlanarEvent< T > *p, AABB &V, int &Nl, int &Nr, int &Np) |
AABB | clipBox (AABB &cbox) const |
Static Public Member Functions | |
static bool | planarEventCompare (PlanarEvent< T > &a, PlanarEvent< T > &b) |
static AABB | calcBoundingBox (std::vector< T * > *trList) |
static Axis | intToAxis (int i) |
Private Attributes | |
KDNode< T > * | root |
AABB | bbox |
unsigned int | maxDepth |
unsigned int | leafSize |
Definition at line 101 of file SAHKDtree.hpp.
typedef std::vector< T* >::iterator rcrt::SAHKDtree< T >::vecTIter |
Definition at line 123 of file SAHKDtree.hpp.
typedef std::vector<TraceableEntry<T>* >::iterator rcrt::SAHKDtree< T >::vecTEIter |
Definition at line 124 of file SAHKDtree.hpp.
typedef std::list<PlanarEvent<T> >::iterator rcrt::SAHKDtree< T >::listPEIter |
Definition at line 125 of file SAHKDtree.hpp.
virtual rcrt::SAHKDtree< T >::~SAHKDtree | ( | ) | [inline, virtual] |
Definition at line 119 of file SAHKDtree.hpp.
rcrt::SAHKDtree< T >::S | ( | ) | [inline] |
rcrt::SAHKDtree< T >::S | ( | std::vector< T * > * | trList, | |
int | depth = 40 , |
|||
int | lSize = 2 | |||
) | [inline] |
Intersection rcrt::SAHKDtree< T >::intersect | ( | Ray & | r | ) | const [inline, virtual] |
Intersect a given ray with the tree.
r | the Ray to be traced |
Implements rcrt::Traceable.
Definition at line 133 of file SAHKDtree.hpp.
Intersection rcrt::SAHKDtree< T >::intersectNode | ( | KDNode< T > * | n, | |
Ray & | r | |||
) | const [inline] |
Intersecta given ray with a node.
n | the Node to be intersected | |
r | the Ray to be traced |
Definition at line 151 of file SAHKDtree.hpp.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::intersect(), and rcrt::SAHKDtree< rcrt::Triangle >::intersectNode().
const AABB& rcrt::SAHKDtree< T >::getBoundingBox | ( | ) | const [inline, virtual] |
Implements rcrt::Traceable.
Definition at line 201 of file SAHKDtree.hpp.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::clipBox().
const Point3D& rcrt::SAHKDtree< T >::getCentroid | ( | ) | const [inline, virtual] |
Implements rcrt::Traceable.
Definition at line 206 of file SAHKDtree.hpp.
void rcrt::SAHKDtree< T >::setTraceables | ( | std::vector< T * > * | trList | ) | [inline] |
Definition at line 211 of file SAHKDtree.hpp.
void rcrt::SAHKDtree< T >::buildTree | ( | std::vector< T * > * | trList | ) | [inline] |
Build SAH KD-Tree of a list of primitives.
trList | vector of Traceables |
Definition at line 220 of file SAHKDtree.hpp.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::setTraceables().
KDNode<T>* rcrt::SAHKDtree< T >::buildNode | ( | AABB & | nbox, | |
std::vector< TraceableEntry< T > * > | trList, | |||
std::list< PlanarEvent< T > > * | eventList, | |||
unsigned int | depth | |||
) | [inline] |
Build SAH KD-Node.
nbox | bounding box of the node to be built | |
trList | vector of Traceables | |
eventList | list of split events for this node | |
depth | local depth of th KD Tree |
Definition at line 258 of file SAHKDtree.hpp.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::buildNode(), and rcrt::SAHKDtree< rcrt::Triangle >::buildTree().
KDNode<T>* rcrt::SAHKDtree< T >::buildLeaf | ( | std::vector< TraceableEntry< T > * > | trList | ) | [inline] |
Build leaf node of given primitives
trList | vector of Traceables |
Definition at line 480 of file SAHKDtree.hpp.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::buildNode().
static bool rcrt::SAHKDtree< T >::planarEventCompare | ( | PlanarEvent< T > & | a, | |
PlanarEvent< T > & | b | |||
) | [inline, static] |
Compares two PlanarEvents (a < b)
a | event a | |
b | event b return a<b |
Definition at line 513 of file SAHKDtree.hpp.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::buildNode(), and rcrt::SAHKDtree< rcrt::Triangle >::buildTree().
void rcrt::SAHKDtree< T >::createPlanarEvents | ( | TraceableEntry< T > * | trEntry, | |
std::list< PlanarEvent< T > > * | eventList, | |||
AABB | tbbox | |||
) | [inline] |
Create split events for a given primitive and bounding box
trEntry | TraceableEntry that contains the primitive the events are created for | |
eventList | list of events the generated events are added to | |
tbbox | bounding box that defines the boundaries of the new events |
Definition at line 526 of file SAHKDtree.hpp.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::buildNode(), rcrt::SAHKDtree< rcrt::Triangle >::buildTree(), and rcrt::SAHKDtree< rcrt::Triangle >::createPlanarEvents().
void rcrt::SAHKDtree< T >::createPlanarEvents | ( | TraceableEntry< T > * | trEntry, | |
std::list< PlanarEvent< T > > * | eventList | |||
) | [inline] |
Definition at line 564 of file SAHKDtree.hpp.
float rcrt::SAHKDtree< T >::C | ( | float & | Pl, | |
float & | Pr, | |||
int | Nl, | |||
int | Nr | |||
) | [inline] |
Calculate the cost of a split candidate
probability | for hitting the left volume | |
probability | for hitting the right volume | |
number | of primitives in left volume | |
number | of primitives in right volume |
Definition at line 580 of file SAHKDtree.hpp.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::SAH().
float rcrt::SAHKDtree< T >::SAH | ( | PlanarEvent< T > * | p, | |
AABB & | V, | |||
int & | Nl, | |||
int & | Nr, | |||
int & | Np | |||
) | [inline] |
Calculate the SAH for a given split candidate and determine where to put primitives lying in the split plane
p | split event for split candidate | |
number | of primitives left of the split plane | |
number | of primitives right of the split plane | |
number | of primitives in the split plane |
Definition at line 597 of file SAHKDtree.hpp.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::buildNode().
static AABB rcrt::SAHKDtree< T >::calcBoundingBox | ( | std::vector< T * > * | trList | ) | [inline, static] |
Calculate the bounding box surrounding all primitives in a given list
vector | of Traceables |
Definition at line 629 of file SAHKDtree.hpp.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::buildTree().
AABB rcrt::SAHKDtree< T >::clipBox | ( | AABB & | cbox | ) | const [inline] |
Definition at line 638 of file SAHKDtree.hpp.
static Axis rcrt::SAHKDtree< T >::intToAxis | ( | int | i | ) | [inline, static] |
Convert integer to axis
i | the int |
Definition at line 648 of file SAHKDtree.hpp.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::buildNode(), and rcrt::SAHKDtree< rcrt::Triangle >::createPlanarEvents().
KDNode<T>* rcrt::SAHKDtree< T >::root [private] |
Definition at line 104 of file SAHKDtree.hpp.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::buildTree(), and rcrt::SAHKDtree< rcrt::Triangle >::intersect().
AABB rcrt::SAHKDtree< T >::bbox [private] |
Definition at line 105 of file SAHKDtree.hpp.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::buildTree(), rcrt::SAHKDtree< rcrt::Triangle >::getBoundingBox(), rcrt::SAHKDtree< rcrt::Triangle >::getCentroid(), and rcrt::SAHKDtree< rcrt::Triangle >::intersect().
unsigned int rcrt::SAHKDtree< T >::maxDepth [private] |
Definition at line 106 of file SAHKDtree.hpp.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::buildNode().
unsigned int rcrt::SAHKDtree< T >::leafSize [private] |
Definition at line 106 of file SAHKDtree.hpp.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::buildNode().