rcrt::AABB Class Reference

#include <AABB.h>

Inheritance diagram for rcrt::AABB:

Inheritance graph
[legend]
Collaboration diagram for rcrt::AABB:

Collaboration graph
[legend]

List of all members.

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 AABBgetBoundingBox () const
virtual const Point3DgetCentroid () 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 Point3DgetMinP () const
const Point3DgetMaxP () 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


Detailed Description

An Axis Aligned Bounding Box.

Definition at line 16 of file AABB.h.


Constructor & Destructor Documentation

rcrt::AABB::AABB ( SolidObject parent = 0  ) 

This creates a box from infinity to -infinity in all coordinates. It can thus be easily extended.

Parameters:
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 
)

Parameters:
min The minimum(not necessarily) point of the AABB.
max The maximum(not necessarily) point of the AABB.
parent The parent object of this box.

Definition at line 16 of file AABB.cpp.

References extend().

rcrt::AABB::~AABB (  )  [virtual]

Definition at line 24 of file AABB.cpp.


Member Function Documentation

Intersection rcrt::AABB::intersect ( Ray r  )  const [virtual]

Parameters:
The ray that will be tested against.
Returns:
An Intersection that contains the closest intersection that can be determined.

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]

Returns:
The minimum Axis-Aligned Bounding Box of this Traceable.

Implements rcrt::Traceable.

Definition at line 120 of file AABB.cpp.

const Point3D & rcrt::AABB::getCentroid (  )  const [virtual]

Returns:
Some kind of central point of this object. This may just be an approximation (e.g. the central point of the AABB).

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  ) 

Parameters:
box Extend this box to include the other box.

Definition at line 131 of file AABB.cpp.

References maxP, and minP.

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  ) 

Parameters:
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

Parameters:
a an axis.
Returns:
the length along the given 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

Returns:
the Axis that has the largest length.

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

Parameters:
a an Axis.
Returns:
the minimum along an Axis equivalend to calling getMinP()[a]

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

Parameters:
a an Axis.
Returns:
the maximum along an Axis equivalend to calling getMaxP()[a]

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

Parameters:
box a box to compare against.
Returns:
whether this box equals the other box in location and size

Definition at line 215 of file AABB.cpp.

References rcrt::Point3D::equals(), maxP, and minP.

AABB rcrt::AABB::transformed ( const Matrix4D mat  )  const

Parameters:
mat a matrix
Returns:
an AABB that encompasses the points of an AABB transformed by the given Matrix4D.

Definition at line 220 of file AABB.cpp.

References extend(), maxP, and minP.

Vec3D rcrt::AABB::getSNormal ( float  a,
float  b 
) const [virtual]

Parameters:
a 2D Parameterization of the surface
b 2D Parameterization of the surface
Returns:
The local space shading normal of the parameterized point on the primitive.

Implements rcrt::Primitive.

Definition at line 234 of file AABB.cpp.

References getGNormal().

Vec3D rcrt::AABB::getGNormal ( float  a,
float  b 
) const [virtual]

Parameters:
a 2D Parameterization of the surface
b 2D Parameterization of the surface
Returns:
The local space geometry normal of the parameterized point on the primitive.

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]

Parameters:
a 2D Parameterization of the surface
b 2D Parameterization of the surface
Returns:
UV texture coordinates of this point.

Implements rcrt::Primitive.

Definition at line 269 of file AABB.cpp.

float rcrt::AABB::getVolume (  )  const

Returns:
the volume of this box.

Definition at line 274 of file AABB.cpp.

References maxP, and minP.

float rcrt::AABB::getSurfaceArea (  )  const

Returns:
the surface area of this box.

Definition at line 279 of file AABB.cpp.

References maxP, and minP.

Referenced by rcrt::SAHKDtree< rcrt::Triangle >::buildNode(), and rcrt::SAHKDtree< rcrt::Triangle >::SAH().

bool rcrt::AABB::isEmpty (  )  const

Returns:
Whether this box does not contain any volume.

Definition at line 287 of file AABB.cpp.

References maxP, and minP.

void rcrt::AABB::contract ( const AABB box  ) 

Shrinks this box to the minimum of this or the other box along all axes.

Parameters:
box an AABB.

Definition at line 291 of file AABB.cpp.

References getMaxP(), getMinP(), maxP, and minP.

Referenced by rcrt::SAHKDtree< rcrt::Triangle >::buildNode().

void rcrt::AABB::clipPlane ( Axis  axis,
float  plane,
AABB lBox,
AABB rBox 
) const [virtual]

Parameters:
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.

Definition at line 303 of file AABB.cpp.

References AABB(), maxP, and minP.


Member Data Documentation

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]

Definition at line 19 of file AABB.h.

Referenced by AABB(), extend(), and getCentroid().


The documentation for this class was generated from the following files:
Generated on Thu Jan 31 19:33:02 2008 for RenderingCompetitionRayTracer by  doxygen 1.5.3