Support Forum       Library Source       SourceForge Page       G3D Web Page     
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Friends | List of all members
G3D::AABox Class Reference

An axis-aligned box. More...

Public Member Functions

 AABox ()
 Creates the empty bounds, i.e., an empty set of points.
 
 AABox (const Point3 &v)
 Constructs a zero-volume AABox at v.
 
 AABox (const class Any &a)
 Format is one of:
 
 AABox (const Point3 &low, const Point3 &high)
 Assumes that low is less than or equal to high along each dimension.
 
float area () const
 
Point3 center () const
 Returns the centroid of the box (NaN if empty)
 
bool contains (const AABox &other) const
 less than or equal to containment
 
bool contains (const Point3 &point) const
 
Point3 corner (int index) const
 
bool culledBy (const Array< Plane > &plane, int32 &cullingPlaneIndex, const uint32 testMask, uint32 &childMask) const
 Conservative culling test for up to 32 planes.
 
bool culledBy (const Array< Plane > &plane, int32 &cullingPlaneIndex=dummy, const uint32 testMask=0xFFFFFFFF) const
 Conservative culling test that does not produce a mask for children.
 
void deserialize (class BinaryInput &b)
 
float extent (int a) const
 Distance from corner(0) to the next corner along axis a.
 
Vector3 extent () const
 
void getBounds (AABox &out) const
 
void getBounds (Sphere &out) const
 
size_t hashCode () const
 
const Point3high () const
 Returns not-a-number if empty.
 
AABox intersect (const AABox &other) const
 Return the intersection of the two boxes.
 
bool intersects (const AABox &other) const
 Returns true if there is any overlap.
 
bool intersects (const Sphere &other) const
 Returns true if there is any overlap.
 
bool isEmpty () const
 
bool isFinite () const
 
const Point3low () const
 Returns not-a-number if empty.
 
void merge (const AABox &a)
 Grows to include the bounds of a.
 
void merge (const Point3 &a)
 
bool operator!= (const AABox &b) const
 
AABox operator+ (const Vector3 &v) const
 
AABox operator- (const Vector3 &v) const
 
bool operator== (const AABox &b) const
 
Point3 randomInteriorPoint () const
 
Point3 randomSurfacePoint () const
 
void serialize (class BinaryOutput &b) const
 
void set (const Point3 &low, const Point3 &high)
 Assumes that low is less than or equal to high along each dimension.
 
void split (const Vector3::Axis &axis, float location, AABox &low, AABox &high) const
 Splits the box into two AABoxes along the specified axis.
 
Any toAny () const
 
float volume () const
 

Static Public Member Functions

static const AABoxempty ()
 
static const AABoxinf ()
 
static const AABoxlarge ()
 A large finite box.
 
static const AABoxmaxFinite ()
 The largest possible finite box.
 
static const AABoxzero ()
 

Friends

class Intersect
 

Detailed Description

An axis-aligned box.

Constructor & Destructor Documentation

G3D::AABox::AABox ( )
inline

Creates the empty bounds, i.e., an empty set of points.

Referenced by intersect().

G3D::AABox::AABox ( const Point3 v)
inlineexplicit

Constructs a zero-volume AABox at v.

G3D::AABox::AABox ( const class Any a)
explicit

Format is one of:

G3D::AABox::AABox ( const Point3 low,
const Point3 high 
)
inline

Assumes that low is less than or equal to high along each dimension.

To have this automatically enforced, use AABox(low.min(high), low.max(high));

Member Function Documentation

float G3D::AABox::area ( ) const
inline
Point3 G3D::AABox::center ( ) const
inline

Returns the centroid of the box (NaN if empty)

Referenced by G3D::TriangleShape::boundingSphere(), and G3D::KDTree< T, BoundsFunc, HashFunc, EqualsFunc >::Handle::Handle().

bool G3D::AABox::contains ( const AABox other) const
inline
bool G3D::AABox::contains ( const Point3 point) const
inline
Point3 G3D::AABox::corner ( int  index) const
bool G3D::AABox::culledBy ( const Array< Plane > &  plane,
int32 cullingPlaneIndex,
const uint32  testMask,
uint32 childMask 
) const

Conservative culling test for up to 32 planes.

Returns true if there exists a plane[p] for which the entire object is in the negative half space (opposite the plane normal).

testMask and childMask are used for optimizing bounding volume hierarchies. The version of this method that produces childMask is slower than the version without; it should only be used for parent nodes.

Parameters
cullingPlaneIndexThe index of the first plane for which the entire object is in the negative half-space. The function exits early when one plane is found. -1 when the function returns false (i.e. when no plane culls the whole object).
testMaskIf bit p is 0, the bounding volume automatically passes the culling test for plane[p] (i.e. it is known that the volume is entirely within the positive half space). The function must return false if testMask is 0 and test all planes when testMask is -1 (0xFFFFFFFF).
childMaskTest mask for the children of this volume.
bool G3D::AABox::culledBy ( const Array< Plane > &  plane,
int32 cullingPlaneIndex = dummy,
const uint32  testMask = 0xFFFFFFFF 
) const

Conservative culling test that does not produce a mask for children.

void G3D::AABox::deserialize ( class BinaryInput b)
static const AABox& G3D::AABox::empty ( )
static

Referenced by intersect().

float G3D::AABox::extent ( int  a) const
inline

Distance from corner(0) to the next corner along axis a.

Referenced by G3D::TriangleShape::boundingSphere().

Vector3 G3D::AABox::extent ( ) const
inline
void G3D::AABox::getBounds ( AABox out) const
inline
void G3D::AABox::getBounds ( Sphere out) const
size_t G3D::AABox::hashCode ( ) const
inline
const Point3& G3D::AABox::high ( ) const
inline
static const AABox& G3D::AABox::inf ( )
static
AABox G3D::AABox::intersect ( const AABox other) const
inline

Return the intersection of the two boxes.

Referenced by G3D::KDTree< T, BoundsFunc, HashFunc, EqualsFunc >::Handle::Handle().

bool G3D::AABox::intersects ( const AABox other) const
bool G3D::AABox::intersects ( const Sphere other) const

Returns true if there is any overlap.

Referenced Code:
Jim Arvo's algorithm from Graphics Gems II
bool G3D::AABox::isEmpty ( ) const
inline
bool G3D::AABox::isFinite ( ) const
inline
static const AABox& G3D::AABox::large ( )
static

A large finite box.

This is smaller than FLT_MAX because it leaves room to add boxes together.

Referenced by G3D::KDTree< Triangle >::balance(), and G3D::KDTree< T, BoundsFunc, HashFunc, EqualsFunc >::Handle::Handle().

const Point3& G3D::AABox::low ( ) const
inline
static const AABox& G3D::AABox::maxFinite ( )
static

The largest possible finite box.

Referenced by G3D::PointKDTree< T, PositionFunc, HashFunc, EqualsFunc >::balance().

void G3D::AABox::merge ( const AABox a)
inline
void G3D::AABox::merge ( const Point3 a)
inline
bool G3D::AABox::operator!= ( const AABox b) const
inline
AABox G3D::AABox::operator+ ( const Vector3 v) const
inline
AABox G3D::AABox::operator- ( const Vector3 v) const
inline
bool G3D::AABox::operator== ( const AABox b) const
inline
Point3 G3D::AABox::randomInteriorPoint ( ) const
Point3 G3D::AABox::randomSurfacePoint ( ) const
void G3D::AABox::serialize ( class BinaryOutput b) const
void G3D::AABox::set ( const Point3 low,
const Point3 high 
)
inline

Assumes that low is less than or equal to high along each dimension.

void G3D::AABox::split ( const Vector3::Axis axis,
float  location,
AABox low,
AABox high 
) const

Splits the box into two AABoxes along the specified axis.

low contains the part that was closer to negative infinity along axis, high contains the other part. Either may have zero volume.

Referenced by G3D::PointKDTree< T, PositionFunc, HashFunc, EqualsFunc >::Node::assignSplitBounds(), and G3D::KDTree< T, BoundsFunc, HashFunc, EqualsFunc >::Node::assignSplitBounds().

Any G3D::AABox::toAny ( ) const
float G3D::AABox::volume ( ) const
inline
static const AABox& G3D::AABox::zero ( )
static

Friends And Related Function Documentation

friend class Intersect
friend

documentation generated on Sat Jan 12 2013 22:49:53 using doxygen 1.8.2