Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::AABB Struct Reference

Axis-aligned bounding box data structure in three dimensions. More...

#include <mitsuba/core/aabb.h>

+ Inheritance diagram for mitsuba::AABB:

Public Member Functions

 AABB ()
 Create a new invalid bounding box. More...
 
 AABB (Stream *stream)
 Unserialize a bounding box from a binary data stream. More...
 
 AABB (const Point &p)
 Create a collapsed AABB from a single point. More...
 
 AABB (const PointType &min, const PointType &max)
 Create a bounding box from two positions. More...
 
 AABB (const TAABB< Point > &aabb)
 Construct from a TAABB<Point> More...
 
Float getSurfaceArea () const
 Calculate the surface area of the bounding box. More...
 
Point getCorner (uint8_t corner) const
 Return the position of a bounding box corner. More...
 
bool overlaps (const BSphere &sphere) const
 Bounding sphere-box overlap test. More...
 
BSphere getBSphere () const
 Create a bounding sphere, which contains the axis-aligned box. More...
 
- Public Member Functions inherited from mitsuba::TAABB< Point >
 TAABB ()
 Create a new invalid bounding box. More...
 
 TAABB (Stream *stream)
 Unserialize a bounding box from a binary data stream. More...
 
 TAABB (const PointType &p)
 Create a collapsed AABB from a single point. More...
 
 TAABB (const PointType &min, const PointType &max)
 Create a bounding box from two positions. More...
 
 TAABB (const TAABB &aabb)
 Copy constructor. More...
 
bool operator== (const TAABB &aabb) const
 Equality test. More...
 
bool operator!= (const TAABB &aabb) const
 Inequality test. More...
 
void clip (const TAABB &aabb)
 Clip to another bounding box. More...
 
void reset ()
 Mark the bounding box as invalid. More...
 
Scalar getVolume () const
 Calculate the n-dimensional volume of the bounding box. More...
 
Float getSurfaceArea () const
 Calculate the n-1 dimensional volume of the boundary. More...
 
PointType getCenter () const
 Return the center point. More...
 
PointType getCorner (int index) const
 Return the position of one of the corners (in 0..2^dim-1) More...
 
TAABB getChild (int index) const
 Return a child bounding box in a interval-, quad-, octree, etc. More...
 
bool contains (const PointType &p) const
 Check whether a point lies on or inside the bounding box. More...
 
bool contains (const TAABB &aabb) const
 Check whether a given bounding box is contained within this one. More...
 
bool overlaps (const TAABB &aabb) const
 Axis-aligned bounding box overlap test. More...
 
void expandBy (const PointType &p)
 Expand the bounding box to contain another point. More...
 
void expandBy (const TAABB &aabb)
 Expand the bounding box to contain another bounding box. More...
 
Scalar squaredDistanceTo (const PointType &p) const
 Calculate the squared point-AABB distance. More...
 
Scalar squaredDistanceTo (const TAABB &aabb) const
 Calculate the minimum squared AABB-AABB distance. More...
 
Scalar distanceTo (const PointType &p) const
 Calculate the point-AABB distance. More...
 
Scalar distanceTo (const TAABB &aabb) const
 Calculate the minimum AABB-AABB distance. More...
 
bool isValid () const
 Return whether this bounding box is valid. More...
 
bool isEmpty () const
 Return whether or not this bounding box covers anything at all. More...
 
int getLargestAxis () const
 Return the axis index with the largest associated side length. More...
 
int getShortestAxis () const
 Return the axis index with the shortest associated side length. More...
 
VectorType getExtents () const
 Calculate the bounding box extents. More...
 
FINLINE bool rayIntersect (const RayType &ray, Float &nearT, Float &farT) const
 Calculate the near and far ray-AABB intersection points (if they exist). More...
 
FINLINE bool rayIntersect (const RayType &ray, Float &nearT, Float &farT, PointType &near, PointType &far) const
 Calculate the overlap between an axis-aligned bounding box and a ray segment. More...
 
void serialize (Stream *stream) const
 Serialize this bounding box to a binary data stream. More...
 
std::string toString () const
 Return a string representation of the bounding box. More...
 

Additional Inherited Members

- Public Types inherited from mitsuba::TAABB< Point >
typedef Point PointType
 
typedef Point::Scalar Scalar
 
typedef Point::VectorType VectorType
 
typedef TRay< PointType,
VectorType
RayType
 
- Public Attributes inherited from mitsuba::TAABB< Point >
PointType min
 Component-wise minimum. More...
 
PointType max
 Component-wise maximum. More...
 

Detailed Description

Axis-aligned bounding box data structure in three dimensions.

Maintains a component-wise minimum and maximum position and provides various convenience functions to query or change them.

Constructor & Destructor Documentation

mitsuba::AABB::AABB ( )
inline

Create a new invalid bounding box.

Initializes the components of the minimum and maximum position to \(\infty\) and \(-\infty\), respectively.

mitsuba::AABB::AABB ( Stream stream)
inline

Unserialize a bounding box from a binary data stream.

mitsuba::AABB::AABB ( const Point p)
inline

Create a collapsed AABB from a single point.

mitsuba::AABB::AABB ( const PointType min,
const PointType max 
)
inline

Create a bounding box from two positions.

mitsuba::AABB::AABB ( const TAABB< Point > &  aabb)
inline

Construct from a TAABB<Point>

Member Function Documentation

BSphere mitsuba::AABB::getBSphere ( ) const

Create a bounding sphere, which contains the axis-aligned box.

Point mitsuba::AABB::getCorner ( uint8_t  corner) const

Return the position of a bounding box corner.

Parameters
cornerRequested corner index (0..7)
Float mitsuba::AABB::getSurfaceArea ( ) const
inline

Calculate the surface area of the bounding box.

bool mitsuba::AABB::overlaps ( const BSphere sphere) const

Bounding sphere-box overlap test.

Implements the technique proposed by Jim Arvo in "A simple method for box-sphere intersection testing" (Graphics Gems, 1990)


The documentation for this struct was generated from the following file: