#include <Box.h>
Collaboration diagram for Box:
Public Member Functions | |
Box () | |
Box (const Vec3f &minVertex, const Vec3f &maxVertex) | |
void | extend (const Vec3f &a) |
void | extend (const Box &box) |
void | clear () |
std::pair< float, float > | intersect (const Ray &ray) const |
const Vec3f & | minVertex () const |
const Vec3f & | maxVertex () const |
float | area (const SplitPlane &plane) const |
std::pair< Box, Box > | split (const SplitPlane &plane) const |
Box | clip (const Box &other) const |
Private Attributes | |
Vec3f | mMin |
Smallest vertex. | |
Vec3f | mMax |
Biggest vertex. |
Definition at line 16 of file Box.h.
Box::Box | ( | ) | [inline] |
void Box::extend | ( | const Vec3f & | a | ) | [inline] |
Extend the box to contain the given point
a | A point to be contained |
Definition at line 41 of file Box.h.
References EPSILON, max(), min(), mMax, and mMin.
Referenced by Triangle::calcBounds(), Sphere::calcBounds(), OBJObject::calcBounds(), InfinitePlane::calcBounds(), and extend().
void Box::extend | ( | const Box & | box | ) | [inline] |
void Box::clear | ( | ) | [inline] |
std::pair<float, float> Box::intersect | ( | const Ray & | ray | ) | const [inline] |
Calculate nearest and farest intersection points.
ray | The ray to intersect with |
Definition at line 70 of file Box.h.
References Ray::dir(), EPSILON, max(), min(), mMax, mMin, Ray::org(), Vec3f::x(), Vec3f::y(), and Vec3f::z().
Referenced by KDTree::intersect().
const Vec3f& Box::minVertex | ( | ) | const [inline] |
Get smallest vertex
Definition at line 113 of file Box.h.
References mMin.
Referenced by OBJObject::calcBounds(), Object::dump(), SAHKDTree::findBestPlane(), SAHKDTree::generateEvents(), and SimpleKDTree::setBestSplit().
const Vec3f& Box::maxVertex | ( | ) | const [inline] |
Get biggest vertex
Definition at line 120 of file Box.h.
References mMax.
Referenced by OBJObject::calcBounds(), Object::dump(), SAHKDTree::findBestPlane(), SAHKDTree::generateEvents(), and SimpleKDTree::setBestSplit().
float Box::area | ( | const SplitPlane & | plane | ) | const [inline] |
Calculate surface area of the bounding box if splitting on the given plane. This method returns the relative area of the left child, area of the right child is also 1 - area()
plane | Split plane |
Definition at line 131 of file Box.h.
References mMax, mMin, and NO_AXIS.
Referenced by SAHKDTree::SAH().
std::pair<Box, Box> Box::split | ( | const SplitPlane & | plane | ) | const [inline] |
Split bounding box at given plane
plane | Split plane |
Definition at line 145 of file Box.h.
References Box(), SplitPlane::direction(), EPSILON, mMax, mMin, NO_AXIS, SplitPlane::position(), Vec3f::x(), X_AXIS, Vec3f::y(), Y_AXIS, Vec3f::z(), and Z_AXIS.
Referenced by SAHKDTree::classifyAndSplice().
Smallest vertex.
Definition at line 174 of file Box.h.
Referenced by area(), clear(), clip(), extend(), intersect(), minVertex(), and split().
Biggest vertex.
Definition at line 177 of file Box.h.
Referenced by area(), clear(), clip(), extend(), intersect(), maxVertex(), and split().