Each interior node provides three pieces of information:
Definition at line 111 of file KDTree.h.
Private Member Functions | |
KDNode () | |
The constructor of the KDNode. | |
~KDNode () | |
The Destructor of the KDNode. | |
bool | isLeafNode () const |
bool | leafIntersect (Ray &ray, float min, float max) |
Checks if the ray intersects any object in this node (leaf node). | |
void | getNearFar (const Ray &r, KDNode *&near, KDNode *&far) |
Returns the children nodes sorted as near and far. | |
float | distanceToSplitPlane (const Ray &ray) const |
Computes the distance to the splitting plane. | |
Private Attributes | |
Axis | _splitAxis |
Which of the x, y or z axes was split at this node. | |
float | _splitPlane |
The position of the splitting plane along the axis. | |
KDNode * | _left |
A pointer to the left child of that node. | |
KDNode * | _right |
A pointer to the right child of that node. | |
std::vector< Primitive * > | _primitives |
The primitives that overlap. | |
Friends | |
class | KDTree |
KDTree::KDNode::KDNode | ( | ) | [private] |
The constructor of the KDNode.
Definition at line 10 of file KDTree.cpp.
References _left, _right, _splitAxis, _splitPlane, and KDTree::NO_AXIS.
KDTree::KDNode::~KDNode | ( | ) | [private] |
bool KDTree::KDNode::isLeafNode | ( | ) | const [inline, private] |
Definition at line 163 of file KDTree.h.
References _splitAxis, and KDTree::NO_AXIS.
Referenced by KDTree::Intersect().
bool KDTree::KDNode::leafIntersect | ( | Ray & | ray, | |
float | min, | |||
float | max | |||
) | [private] |
Checks if the ray intersects any object in this node (leaf node).
ray | The tay to intersect with. | |
min | The minimal t-value. | |
max | The maximal t-value. |
True | iff an intersection is found. |
Definition at line 24 of file KDTree.cpp.
References _primitives, Epsilon, Ray::hit, KDTree::Intersect(), and Ray::t.
Referenced by KDTree::Intersect().
Returns the children nodes sorted as near and far.
r | The ray that intersects that Node. | |
near | The near child is returned in this parameter. | |
far | The far child is returned in this parameter. |
Definition at line 188 of file KDTree.h.
References _left, _right, _splitAxis, _splitPlane, and Ray::org.
Referenced by KDTree::Intersect().
float KDTree::KDNode::distanceToSplitPlane | ( | const Ray & | ray | ) | const [inline, private] |
Computes the distance to the splitting plane.
The | distance from the ray to the splittingplane (scaled by the direction-vector of the ray). |
Definition at line 206 of file KDTree.h.
References _splitAxis, _splitPlane, Ray::dir, and Ray::org.
Referenced by KDTree::Intersect().
Axis KDTree::KDNode::_splitAxis [private] |
Which of the x, y or z axes was split at this node.
Definition at line 120 of file KDTree.h.
Referenced by KDTree::BuildTree(), distanceToSplitPlane(), getNearFar(), isLeafNode(), and KDNode().
float KDTree::KDNode::_splitPlane [private] |
The position of the splitting plane along the axis.
Definition at line 126 of file KDTree.h.
Referenced by KDTree::BuildTree(), distanceToSplitPlane(), getNearFar(), and KDNode().
KDNode * KDTree::KDNode::_left [private] |
A pointer to the left child of that node.
Definition at line 132 of file KDTree.h.
Referenced by KDTree::BuildTree(), getNearFar(), KDNode(), and ~KDNode().
KDNode * KDTree::KDNode::_right [private] |
A pointer to the right child of that node.
Definition at line 138 of file KDTree.h.
Referenced by KDTree::BuildTree(), getNearFar(), KDNode(), and ~KDNode().
std::vector< Primitive * > KDTree::KDNode::_primitives [private] |
The primitives that overlap.
Definition at line 144 of file KDTree.h.
Referenced by KDTree::BuildTree(), leafIntersect(), and KDTree::retrySplit().