#include <AABB.h>
Public Member Functions | |
AABB (SolidObject *parent=0) | |
AABB (const Point3D &min, const Point3D &max, SolidObject *parent=0) | |
virtual | ~AABB () |
virtual Intersection | intersect (Ray &r) const |
virtual const AABB & | getBoundingBox () const |
virtual const Point3D & | getCentroid () const |
void | extend (const AABB &box) |
void | extend (const Point3D &p) |
float | getLength (Axis a) const |
Axis | getMainAxis () const |
float | getMin (Axis a) const |
float | getMax (Axis a) const |
const Point3D & | getMinP () const |
const Point3D & | getMaxP () const |
bool | equals (const AABB &box) const |
AABB | transformed (const Matrix4D &mat) const |
virtual Vec3D | getSNormal (float a, float b) const |
virtual Vec3D | getGNormal (float a, float b) const |
virtual Point2D | getUV (float a, float b) const |
float | getVolume () const |
float | getSurfaceArea () const |
bool | isEmpty () const |
void | contract (const AABB &box) |
virtual void | clipPlane (Axis axis, float plane, AABB &lBox, AABB &rBox) const |
Private Attributes | |
Point3D | minP |
Point3D | maxP |
Point3D | center |
Definition at line 16 of file AABB.h.
rcrt::AABB::AABB | ( | SolidObject * | parent = 0 |
) |
This creates a box from infinity to -infinity in all coordinates. It can thus be easily extended.
parent | The parent object of this box. |
Definition at line 10 of file AABB.cpp.
References center, rcrt::Point3D::getPosVec3D(), maxP, and minP.
Referenced by clipPlane().
rcrt::AABB::AABB | ( | const Point3D & | min, | |
const Point3D & | max, | |||
SolidObject * | parent = 0 | |||
) |
Intersection rcrt::AABB::intersect | ( | Ray & | r | ) | const [virtual] |
The | ray that will be tested against. |
Implements rcrt::Traceable.
Definition at line 29 of file AABB.cpp.
References rcrt::Ray::atDistance(), getLength(), rcrt::Ray::invDir(), maxP, minP, rcrt::Ray::org(), rcrt::Point3D::x(), rcrt::Vec3D::x(), X_AXIS, rcrt::Point3D::y(), rcrt::Vec3D::y(), Y_AXIS, rcrt::Point3D::z(), rcrt::Vec3D::z(), and Z_AXIS.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::intersect(), rcrt::DisplacedTriangle::intersect(), and rcrt::AffineObject::intersect().
const AABB & rcrt::AABB::getBoundingBox | ( | ) | const [virtual] |
const Point3D & rcrt::AABB::getCentroid | ( | ) | const [virtual] |
Implements rcrt::Traceable.
Definition at line 125 of file AABB.cpp.
References center.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::getCentroid(), rcrt::AffineObject::getCentroid(), rcrt::BIH< rcrt::Traceable >::getCentroid(), and rcrt::BIHNode< rcrt::Traceable >::getSplitPlane().
void rcrt::AABB::extend | ( | const AABB & | box | ) |
box | Extend this box to include the other box. |
Definition at line 131 of file AABB.cpp.
Referenced by AABB(), rcrt::SAHKDtree< rcrt::Triangle >::calcBoundingBox(), rcrt::BIH< rcrt::Traceable >::calcBoundingBox(), rcrt::Triangle::clipPlane(), rcrt::ConvexQuad::ConvexQuad(), rcrt::DisplacedTriangle::DisplacedTriangle(), rcrt::PKDNode::PKDNode(), rcrt::Sphere::Sphere(), transformed(), and rcrt::Triangle::updateBox().
void rcrt::AABB::extend | ( | const Point3D & | p | ) |
p | Extend this box to include the point p. |
Definition at line 137 of file AABB.cpp.
References center, rcrt::Point3D::getPosVec3D(), maxP, minP, rcrt::Point3D::x(), rcrt::Point3D::y(), and rcrt::Point3D::z().
float rcrt::AABB::getLength | ( | Axis | a | ) | const |
a | an axis. |
Definition at line 152 of file AABB.cpp.
References maxP, minP, rcrt::Point3D::x(), X_AXIS, rcrt::Point3D::y(), Y_AXIS, and rcrt::Point3D::z().
Referenced by getGNormal(), getMainAxis(), and intersect().
Axis rcrt::AABB::getMainAxis | ( | ) | const |
Definition at line 164 of file AABB.cpp.
References getLength(), X_AXIS, Y_AXIS, and Z_AXIS.
Referenced by rcrt::BIHNode< rcrt::Traceable >::getSplitPlane().
float rcrt::AABB::getMin | ( | Axis | a | ) | const |
a | an Axis. |
Definition at line 181 of file AABB.cpp.
References minP, rcrt::Point3D::x(), X_AXIS, rcrt::Point3D::y(), Y_AXIS, and rcrt::Point3D::z().
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::createPlanarEvents(), and rcrt::BIHNode< rcrt::Traceable >::initNode().
float rcrt::AABB::getMax | ( | Axis | a | ) | const |
a | an Axis. |
Definition at line 193 of file AABB.cpp.
References maxP, rcrt::Point3D::x(), X_AXIS, rcrt::Point3D::y(), Y_AXIS, and rcrt::Point3D::z().
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::createPlanarEvents(), and rcrt::BIHNode< rcrt::Traceable >::initNode().
const Point3D & rcrt::AABB::getMinP | ( | ) | const |
Definition at line 210 of file AABB.cpp.
References minP.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::buildNode(), contract(), rcrt::BIHNode< rcrt::Traceable >::initNode(), rcrt::operator<<(), rcrt::PKDNode::PKDNode(), and rcrt::SAHKDtree< rcrt::Triangle >::SAH().
const Point3D & rcrt::AABB::getMaxP | ( | ) | const |
Definition at line 205 of file AABB.cpp.
References maxP.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::buildNode(), contract(), rcrt::BIHNode< rcrt::Traceable >::initNode(), rcrt::operator<<(), rcrt::PKDNode::PKDNode(), and rcrt::SAHKDtree< rcrt::Triangle >::SAH().
bool rcrt::AABB::equals | ( | const AABB & | box | ) | const |
box | a box to compare against. |
Definition at line 215 of file AABB.cpp.
References rcrt::Point3D::equals(), maxP, and minP.
Vec3D rcrt::AABB::getSNormal | ( | float | a, | |
float | b | |||
) | const [virtual] |
a | 2D Parameterization of the surface | |
b | 2D Parameterization of the surface |
Implements rcrt::Primitive.
Definition at line 234 of file AABB.cpp.
References getGNormal().
Vec3D rcrt::AABB::getGNormal | ( | float | a, | |
float | b | |||
) | const [virtual] |
a | 2D Parameterization of the surface | |
b | 2D Parameterization of the surface |
Implements rcrt::Primitive.
Definition at line 239 of file AABB.cpp.
References getLength(), X_AXIS, Y_AXIS, and Z_AXIS.
Referenced by getSNormal().
Point2D rcrt::AABB::getUV | ( | float | a, | |
float | b | |||
) | const [virtual] |
a | 2D Parameterization of the surface | |
b | 2D Parameterization of the surface |
Implements rcrt::Primitive.
float rcrt::AABB::getVolume | ( | ) | const |
float rcrt::AABB::getSurfaceArea | ( | ) | const |
Definition at line 279 of file AABB.cpp.
Referenced by rcrt::SAHKDtree< rcrt::Triangle >::buildNode(), and rcrt::SAHKDtree< rcrt::Triangle >::SAH().
bool rcrt::AABB::isEmpty | ( | ) | const |
void rcrt::AABB::contract | ( | const AABB & | box | ) |
axis | The Axis of the plane with which to clip. | |
plane | The value along the axis which describes the plane. | |
lBox | An AABB that should contain the left part (with respect to the clipping plane) of the object after calling this method. | |
rBox | An AABB that should contain the right part of the object after this method. |
Reimplemented from rcrt::Traceable.
Point3D rcrt::AABB::minP [private] |
Definition at line 19 of file AABB.h.
Referenced by AABB(), clipPlane(), contract(), equals(), extend(), getLength(), getMin(), getMinP(), getSurfaceArea(), getVolume(), intersect(), isEmpty(), and transformed().
Point3D rcrt::AABB::maxP [private] |
Definition at line 19 of file AABB.h.
Referenced by AABB(), clipPlane(), contract(), equals(), extend(), getLength(), getMax(), getMaxP(), getSurfaceArea(), getVolume(), intersect(), isEmpty(), and transformed().
Point3D rcrt::AABB::center [private] |