library of assembled shared sources

http://lass.cocamware.com

lass::prim::Aabb3D< T, MinMaxPolicy > Class Template Reference

your momma's axis aligned bounding box. More...

#include <aabb_3d.h>


Data Structures

struct  Rebind

Public Types

enum  { dimension = TPoint::dimension }
typedef Aabb3D< T, MinMaxPolicy > TSelf
typedef MinMaxPolicy TMinMaxPolicy
typedef Point3D< T > TPoint
typedef Point3DH< T > TPointH
typedef TPoint::TVector TVector
typedef TPoint::TValue TValue
typedef TPoint::TParam TParam
typedef TPoint::TReference TReference
typedef TPoint::TConstReference TConstReference
typedef TPoint::TNumTraits TNumTraits

Public Member Functions

 Aabb3D ()
 Construct an empty bounding box.
 Aabb3D (const TPoint &min, const TPoint &max)
 Construct bounding box, spanned by min and max.
 Aabb3D (const TPoint &point)
 Construct bounding box around a single point (min == max).
template<class MMP2 >
 Aabb3D (const Aabb3D< T, MMP2 > &other)
 copy constructor.
const TPointmin () const
 return corner with smallest component values
const TPointmax () const
 Return corner with largest component values.
void setMin (const TPoint &min)
 set corner with smallest component values
void setMax (const TPoint &max)
 set corner with larges component values
template<class MMP2 >
TSelfoperator= (const Aabb3D< T, MMP2 > &other)
 assign one bounding box to another.
TSelfoperator+= (const TPoint &point)
 Expand bounding box so it contains point.
template<class MMP2 >
TSelfoperator+= (const Aabb3D< T, MMP2 > &other)
 Expand boundix box so it contains the other bounding box.
void grow (TParam iDistance)
 Expand bounding box by distance iDistance.
void grow (TVector iDistance)
 Expand bounding box by axis-dependent distance.
void scale (TParam iScale)
 Scale bounding box by scale iScale.
const TPointH center () const
 Return the center point of the bounding box.
const TVector size () const
 Return size of bounding box per axis, max - min.
const TValue area () const
 Returns surface area of bounding box.
const TValue volume () const
 Returns volume of bounding box.
const Side classify (const TPoint &point) const
 Classify if a point is in or outside the bounding box, or on its surface.
const bool contains (const TPoint &point) const
 Returns true if point is inside bounding box or on its surface.
template<class MMP2 >
const bool contains (const Aabb3D< T, MMP2 > &other) const
 Returns true if the AABB other is inside (or on its surface) this AABB.
template<class MMP2 >
const bool intersects (const Aabb3D< T, MMP2 > &other) const
 Check if two axis-aligned bounding boxes do intersect.
template<class MMP2 >
const bool collides (const Aabb3D< T, MMP2 > &other) const
 Check if two axis-aligned bounding boxes do dollide.
template<class RandomGenerator >
const TPoint random (RandomGenerator &random) const
 Return a random point so that bounding box contains it.
void clear ()
 set AABB to an empty box
const bool isEmpty () const
 Return true if bounding box contains no points.
const bool isValid () const
 internal check to see if AABB is valid.
template<typename MMP2 >
void swap (Aabb3D< T, MMP2 > &other)
 swap two bounding boxes.

Private Attributes

TPoint min_
TPoint max_

Related Functions

(Note that these are not member functions.)

template<typename T , class MMPa , class MMPb >
const Aabb3D< T, MMPa > operator+ (const Aabb3D< T, MMPa > &a, const Aabb3D< T, MMPb > &b)
 join two AABBs
template<typename T , class MMP >
const Aabb3D< T, MMP > operator+ (const Aabb3D< T, MMP > &a, const Point3D< T > &b)
 add a point to an AABB
template<typename T , class MMP >
const Aabb3D< T, MMP > operator+ (const Point3D< T > &a, const Aabb3D< T, MMP > &b)
 add a point to an AABB
template<typename T >
const Aabb3D< T > aabb (const Point3D< T > &point)
template<typename T , class MMP >
distance (const Aabb3D< T, MMP > &a, const Point3D< T > &b)
 distance between AABB and point
template<typename T , class MMPa , class MMPb >
distance (const Aabb3D< T, MMPa > &a, const Aabb3D< T, MMPb > &b)
 distance between two AABBs
template<typename T , class MMPa , class MMPb , class MMPr >
Result intersect (const Aabb3D< T, MMPa > &a, const Aabb3D< T, MMPb > &b, Aabb3D< T, MMPr > &result)
 Calculate the intersection of two axis aligned bounding boxes.
template<typename T , class MMP >
std::ostream & operator<< (std::ostream &stream, const Aabb3D< T, MMP > &aabb)
template<typename T , class MMP >
io::XmlOStreamoperator<< (io::XmlOStream &stream, const Aabb3D< T, MMP > &aabb)
template<typename T >
Aabb3D< T > aabb (const Parallelogram3D< T > &parallelogram)
 determine axis aligned bounding box of a 3D parallelogram
template<typename T , class EP , class NP >
Aabb3D< T > aabb (const SimplePolygon3D< T, EP, NP > &polygon)
 determine axis aligned bounding box of a 3D simple polygon
template<typename T , typename MMP >
Sphere3D< T > boundingSphere (const Aabb3D< T, MMP > &box)
template<typename T , typename MMP >
const bool intersects (const Aabb3D< T, MMP > &aabb, const Sphere3D< T > &sphere)
template<typename T , typename MMP >
const bool collides (const Aabb3D< T, MMP > &aabb, const Sphere3D< T > &sphere)
template<typename T >
Aabb3D< T > aabb (const Triangle3D< T > &triangle)
 determine axis aligned bounding box of a 3D triangle


Detailed Description

template<typename T, class MinMaxPolicy = StrictMinMax>
class lass::prim::Aabb3D< T, MinMaxPolicy >

your momma's axis aligned bounding box.

Author:
Bram de Greve [BdG]
Date:
2003
An AABB (Axis Aligned Bounding Box) is a rectangular box of a given dimension (in this case a 3D box), that is often used as a simple bounding volume of another primitive or data structure.

"A form of a bounding box where the box is aligned to the axis therefore only two points in space are needed to define it. AABB's are much faster to use, and take up less memory, but are very limited in the sense that they can only be aligned to the axis.", http://www.gamedev.net/dict/term.asp?TermID=525

The way an AABB handles its minima and maxima can be set by the MinMaxPolicy. On policy StrictPolicy will enforce you to use correct minima and maxima, and on any suspicious behaviour, it will throw an exception. The other policy AutoPolicy will try to correct misbehaviour without your notice. For more information on these policies, I refer to the documentation compagning these policies.

Definition at line 88 of file aabb_3d.h.


Member Typedef Documentation

template<typename T , class MinMaxPolicy = StrictMinMax>
typedef Aabb3D<T, MinMaxPolicy> lass::prim::Aabb3D< T, MinMaxPolicy >::TSelf

Definition at line 92 of file aabb_3d.h.

template<typename T , class MinMaxPolicy = StrictMinMax>
typedef MinMaxPolicy lass::prim::Aabb3D< T, MinMaxPolicy >::TMinMaxPolicy

Definition at line 93 of file aabb_3d.h.

template<typename T , class MinMaxPolicy = StrictMinMax>
typedef Point3D<T> lass::prim::Aabb3D< T, MinMaxPolicy >::TPoint

Definition at line 95 of file aabb_3d.h.

template<typename T , class MinMaxPolicy = StrictMinMax>
typedef Point3DH<T> lass::prim::Aabb3D< T, MinMaxPolicy >::TPointH

Definition at line 96 of file aabb_3d.h.

template<typename T , class MinMaxPolicy = StrictMinMax>
typedef TPoint::TVector lass::prim::Aabb3D< T, MinMaxPolicy >::TVector

Definition at line 97 of file aabb_3d.h.

template<typename T , class MinMaxPolicy = StrictMinMax>
typedef TPoint::TValue lass::prim::Aabb3D< T, MinMaxPolicy >::TValue

Definition at line 99 of file aabb_3d.h.

template<typename T , class MinMaxPolicy = StrictMinMax>
typedef TPoint::TParam lass::prim::Aabb3D< T, MinMaxPolicy >::TParam

Definition at line 100 of file aabb_3d.h.

template<typename T , class MinMaxPolicy = StrictMinMax>
typedef TPoint::TReference lass::prim::Aabb3D< T, MinMaxPolicy >::TReference

Definition at line 101 of file aabb_3d.h.

template<typename T , class MinMaxPolicy = StrictMinMax>
typedef TPoint::TConstReference lass::prim::Aabb3D< T, MinMaxPolicy >::TConstReference

Definition at line 102 of file aabb_3d.h.

template<typename T , class MinMaxPolicy = StrictMinMax>
typedef TPoint::TNumTraits lass::prim::Aabb3D< T, MinMaxPolicy >::TNumTraits

Definition at line 103 of file aabb_3d.h.


Member Enumeration Documentation

template<typename T , class MinMaxPolicy = StrictMinMax>
anonymous enum

Enumerator:
dimension 

Definition at line 105 of file aabb_3d.h.


Constructor & Destructor Documentation

template<typename T , class MMP >
lass::prim::Aabb3D< T, MMP >::Aabb3D (  )  [inline]

Construct an empty bounding box.

Definition at line 63 of file aabb_3d.inl.

References lass::prim::Aabb3D< T, MinMaxPolicy >::isEmpty(), and LASS_ASSERT.

template<typename T , class MMP >
lass::prim::Aabb3D< T, MMP >::Aabb3D ( const TPoint min,
const TPoint max 
) [inline]

template<typename T , class MMP >
lass::prim::Aabb3D< T, MMP >::Aabb3D ( const TPoint point  )  [inline, explicit]

Construct bounding box around a single point (min == max).

Definition at line 88 of file aabb_3d.inl.

References lass::prim::Aabb3D< T, MinMaxPolicy >::isValid(), and LASS_ASSERT.

template<typename T , class MMP >
template<class MMP2 >
lass::prim::Aabb3D< T, MMP >::Aabb3D ( const Aabb3D< T, MMP2 > &  other  )  [inline]

copy constructor.

Definition at line 101 of file aabb_3d.inl.


Member Function Documentation

template<typename T , class MMP >
const Aabb3D< T, MMP >::TPoint & lass::prim::Aabb3D< T, MMP >::min (  )  const [inline]

template<typename T , class MMP >
const Aabb3D< T, MMP >::TPoint & lass::prim::Aabb3D< T, MMP >::max (  )  const [inline]

template<typename T , class MMP >
void lass::prim::Aabb3D< T, MMP >::setMin ( const TPoint min  )  [inline]

template<typename T , class MMP >
void lass::prim::Aabb3D< T, MMP >::setMax ( const TPoint max  )  [inline]

template<typename T , class MMP >
template<class MMP2 >
Aabb3D< T, MMP >::TSelf & lass::prim::Aabb3D< T, MMP >::operator= ( const Aabb3D< T, MMP2 > &  other  )  [inline]

assign one bounding box to another.

Definition at line 174 of file aabb_3d.inl.

References lass::prim::Aabb3D< T, MinMaxPolicy >::swap().

template<typename T , class MMP >
Aabb3D< T, MMP >::TSelf & lass::prim::Aabb3D< T, MMP >::operator+= ( const TPoint point  )  [inline]

template<typename T , class MMP >
template<class MMP2 >
Aabb3D< T, MMP >::TSelf & lass::prim::Aabb3D< T, MMP >::operator+= ( const Aabb3D< T, MMP2 > &  other  )  [inline]

template<typename T , class MMP >
void lass::prim::Aabb3D< T, MMP >::grow ( TParam  iDistance  )  [inline]

Expand bounding box by distance iDistance.

Negative values causing reversal of the bounding box will cause the box to shrink to the empty box.

Definition at line 215 of file aabb_3d.inl.

template<typename T , class MMP >
void lass::prim::Aabb3D< T, MMP >::grow ( TVector  iDistance  )  [inline]

Expand bounding box by axis-dependent distance.

Negative values causing reversal of the bounding box will cause the box to shrink to the empty box.

Definition at line 225 of file aabb_3d.inl.

References lass::prim::Aabb3D< T, MinMaxPolicy >::clear(), lass::prim::Aabb3D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb3D< T, MinMaxPolicy >::max_, lass::prim::Aabb3D< T, MinMaxPolicy >::min_, lass::prim::Point3D< T >::x, lass::prim::Point3D< T >::y, and lass::prim::Point3D< T >::z.

template<typename T , class MMP >
void lass::prim::Aabb3D< T, MMP >::scale ( TParam  iScale  )  [inline]

Scale bounding box by scale iScale.

Fractions will shrink the bounding box. The origin of scaling is the center of the bounding box. Negative values of the scale have same effect as positive ones.

Definition at line 242 of file aabb_3d.inl.

References lass::num::abs(), lass::prim::Aabb3D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb3D< T, MinMaxPolicy >::max_, lass::prim::Aabb3D< T, MinMaxPolicy >::min_, and lass::prim::Aabb3D< T, MinMaxPolicy >::size().

template<typename T , class MMP >
const Aabb3D< T, MMP >::TPointH lass::prim::Aabb3D< T, MMP >::center (  )  const [inline]

Return the center point of the bounding box.

We return a homogeneous point to avoid the division by two (that might not be supported by some types like integers)

Definition at line 258 of file aabb_3d.inl.

References lass::prim::Aabb3D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb3D< T, MinMaxPolicy >::max_, and lass::prim::Aabb3D< T, MinMaxPolicy >::min_.

Referenced by lass::prim::Aabb3D< T, MinMaxPolicy >::boundingSphere(), lass::prim::Aabb3D< T, MinMaxPolicy >::collides(), and lass::prim::Aabb3D< T, MinMaxPolicy >::intersects().

template<typename T , class MMP >
const Aabb3D< T, MMP >::TVector lass::prim::Aabb3D< T, MMP >::size (  )  const [inline]

template<typename T , class MMP >
const Aabb3D< T, MMP >::TValue lass::prim::Aabb3D< T, MMP >::area (  )  const [inline]

Returns surface area of bounding box.

the surface of a bounding box consists of three pair of rectangles

Definition at line 283 of file aabb_3d.inl.

References lass::prim::Aabb3D< T, MinMaxPolicy >::size(), lass::prim::Vector3D< T >::x, lass::prim::Vector3D< T >::y, and lass::prim::Vector3D< T >::z.

template<typename T , class MMP >
const Aabb3D< T, MMP >::TValue lass::prim::Aabb3D< T, MMP >::volume (  )  const [inline]

template<typename T , class MMP >
const Side lass::prim::Aabb3D< T, MMP >::classify ( const TPoint point  )  const [inline]

template<typename T , class MMP >
const bool lass::prim::Aabb3D< T, MMP >::contains ( const TPoint point  )  const [inline]

template<typename T , class MMP >
template<class MMP2 >
const bool lass::prim::Aabb3D< T, MMP >::contains ( const Aabb3D< T, MMP2 > &  other  )  const [inline]

Returns true if the AABB other is inside (or on its surface) this AABB.

  • Is equivalent to this->contains(other.min()) && this->contains(other.max()).
  • if other is an empty AABB, it will always return true (an empty set is always a part of any other set).

Definition at line 350 of file aabb_3d.inl.

References lass::prim::Aabb3D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb3D< T, MinMaxPolicy >::max(), lass::prim::Aabb3D< T, MinMaxPolicy >::max_, lass::prim::Aabb3D< T, MinMaxPolicy >::min(), lass::prim::Aabb3D< T, MinMaxPolicy >::min_, lass::prim::Point3D< T >::x, lass::prim::Point3D< T >::y, and lass::prim::Point3D< T >::z.

template<typename T , class MMP >
template<class MMP2 >
const bool lass::prim::Aabb3D< T, MMP >::intersects ( const Aabb3D< T, MMP2 > &  other  )  const [inline]

Check if two axis-aligned bounding boxes do intersect.

Returns:
  • false intersection of the AABBs is empty.
  • true intersection of the AABBs is not empty.
FAQ: What's the difference between this->intersects(other) and this->collides(other) ?
When two AABB are touching each other (surface to surface), the intersection isn't empty. i.e. the intersection is the line of points that belong to both the surfaces of the AABBs. In that case, the intersection is a degenerated AABB though, one with volume()==0. In collision detection however, you don't want this degenerated case of intersection to be considered as a collision. Two bodies may touch, but the must not have an overlap thas has a non-zero volume. That's why we have two methods: intersects returns true on touching AABBs, collides will return false. Of course, in the non-degenerate cases, they behave the same.
Use the seperating axis test to test if two AABB's do intersect: GOMEZ M. (1999), Simple Intersection Tests For Games, Gamasutra, http://www.gamasutra.com, http://www.gamasutra.com/features/19991018/Gomez_3.htm

Definition at line 381 of file aabb_3d.inl.

References lass::num::abs(), lass::prim::Aabb3D< T, MinMaxPolicy >::center(), lass::prim::Aabb3D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb3D< T, MinMaxPolicy >::size(), lass::prim::Point3DH< T >::weight(), lass::prim::Vector3D< T >::x, lass::prim::Vector3D< T >::y, and lass::prim::Vector3D< T >::z.

Referenced by lass::prim::Aabb3D< T, MinMaxPolicy >::intersect(), and lass::prim::intersects().

template<typename T , class MMP >
template<class MMP2 >
const bool lass::prim::Aabb3D< T, MMP >::collides ( const Aabb3D< T, MMP2 > &  other  )  const [inline]

Check if two axis-aligned bounding boxes do dollide.

Returns:
  • true the AABBs do collide.
  • false they don't.
FAQ: What's the difference between this->intersects(other) and this->collides(other) ?
When two AABB are touching each other (surface to surface), the intersection isn't empty. i.e. the intersection is the line of points that belong to both the surfaces of the AABBs. In that case, the intersection is a degenerated AABB though, one with volume()==0. In collision detection however, you don't want this degenerated case of intersection to be considered as a collision. Two bodies may touch, but the must not have an overlap thas has a non-zero volume. That's why we have two methods: intersects returns true on touching AABBs, collides will return false. Of course, in the non-degenerate cases, they behave the same.
Use the seperating axis test to test if two AABB's do intersect: GOMEZ M. (1999), Simple Intersection Tests For Games, Gamasutra, http://www.gamasutra.com, http://www.gamasutra.com/features/19991018/Gomez_3.htm

Definition at line 425 of file aabb_3d.inl.

References lass::num::abs(), lass::prim::Aabb3D< T, MinMaxPolicy >::center(), lass::prim::Aabb3D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb3D< T, MinMaxPolicy >::size(), lass::prim::Point3DH< T >::weight(), lass::prim::Vector3D< T >::x, lass::prim::Vector3D< T >::y, and lass::prim::Vector3D< T >::z.

Referenced by lass::prim::collides().

template<typename T , class MMP >
template<class RandomGenerator >
const Aabb3D< T, MMP >::TPoint lass::prim::Aabb3D< T, MMP >::random ( RandomGenerator &  random  )  const [inline]

template<typename T , class MMP >
void lass::prim::Aabb3D< T, MMP >::clear (  )  [inline]

template<typename T , class MMP >
const bool lass::prim::Aabb3D< T, MMP >::isEmpty (  )  const [inline]

template<typename T , class MMP >
const bool lass::prim::Aabb3D< T, MMP >::isValid (  )  const [inline]

internal check to see if AABB is valid.

There are two valid states for the AABB:

  • max_.x < min_.x which means the box is empty
  • max_.x >= min_.x && max_.y >= min_.y && max_.z >= min_.z which means the box is not empty. That gives us an invalid state as well:
  • max_.x >= min_.x && (max_.y < min_.y || max_.z < min_.z). This state would cause isEmpty() to yield false, while there's still nothing in it (there's no single point for which contains(p) would return true.
When the regular minmax policies are used (StrictMinMax and AutoMinMax), there's no way any AABB would become invalid, and this test counts as an invariant to the box. However, when using the UncheckedMinMax policy, you're on your own.

Definition at line 508 of file aabb_3d.inl.

References lass::prim::Aabb3D< T, MinMaxPolicy >::max_, lass::prim::Aabb3D< T, MinMaxPolicy >::min_, lass::prim::Point3D< T >::x, lass::prim::Point3D< T >::y, and lass::prim::Point3D< T >::z.

Referenced by lass::prim::Aabb3D< T, MinMaxPolicy >::Aabb3D(), lass::prim::Aabb3D< T, MinMaxPolicy >::center(), lass::prim::Aabb3D< T, MinMaxPolicy >::classify(), lass::prim::Aabb3D< T, MinMaxPolicy >::clear(), lass::prim::Aabb3D< T, MinMaxPolicy >::collides(), lass::prim::Aabb3D< T, MinMaxPolicy >::contains(), lass::prim::Aabb3D< T, MinMaxPolicy >::grow(), lass::prim::Aabb3D< T, MinMaxPolicy >::intersect(), lass::prim::Aabb3D< T, MinMaxPolicy >::intersects(), lass::prim::Aabb3D< T, MinMaxPolicy >::isEmpty(), lass::prim::Aabb3D< T, MinMaxPolicy >::max(), lass::prim::Aabb3D< T, MinMaxPolicy >::min(), lass::prim::Aabb3D< T, MinMaxPolicy >::operator+=(), lass::prim::Aabb3D< T, MinMaxPolicy >::random(), lass::prim::Aabb3D< T, MinMaxPolicy >::scale(), and lass::prim::Aabb3D< T, MinMaxPolicy >::size().

template<typename T , class MMP >
template<typename MMP2 >
void lass::prim::Aabb3D< T, MMP >::swap ( Aabb3D< T, MMP2 > &  other  )  [inline]


Friends And Related Function Documentation

template<typename T , class MMPa , class MMPb >
const Aabb3D< T, MMPa > operator+ ( const Aabb3D< T, MMPa > &  a,
const Aabb3D< T, MMPb > &  b 
) [related]

join two AABBs

Definition at line 533 of file aabb_3d.inl.

template<typename T , class MMP >
const Aabb3D< T, MMP > operator+ ( const Aabb3D< T, MMP > &  a,
const Point3D< T > &  b 
) [related]

add a point to an AABB

Definition at line 546 of file aabb_3d.inl.

template<typename T , class MMP >
const Aabb3D< T, MMP > operator+ ( const Point3D< T > &  a,
const Aabb3D< T, MMP > &  b 
) [related]

add a point to an AABB

Definition at line 559 of file aabb_3d.inl.

template<typename T >
const Aabb3D< T > aabb ( const Point3D< T > &  point  )  [related]

Definition at line 571 of file aabb_3d.inl.

template<typename T , class MMP >
T distance ( const Aabb3D< T, MMP > &  a,
const Point3D< T > &  b 
) [related]

distance between AABB and point

Parameters:
a AABB
b point
Returns:
absolute distance between point and AABB. If point is inside AABB, distance is 0.
Precondition:
a should not be empty. Undefined behaviour if it is empty.

Definition at line 586 of file aabb_3d.inl.

References lass::prim::Aabb3D< T, MinMaxPolicy >::isEmpty(), LASS_ASSERT, lass::prim::Aabb3D< T, MinMaxPolicy >::max(), lass::prim::Aabb3D< T, MinMaxPolicy >::min(), lass::num::norm(), and lass::prim::pointwiseMax().

template<typename T , class MMPa , class MMPb >
T distance ( const Aabb3D< T, MMPa > &  a,
const Aabb3D< T, MMPb > &  b 
) [related]

distance between two AABBs

Parameters:
a AABB
b AABB
Returns:
absolute distance. If one AABB is completely inside the other, distance is 0.
Precondition:
a and b should not be empty. Undefined behaviour if they are.

Definition at line 603 of file aabb_3d.inl.

References lass::prim::Aabb3D< T, MinMaxPolicy >::isEmpty(), LASS_ASSERT, lass::prim::Aabb3D< T, MinMaxPolicy >::max(), lass::prim::Aabb3D< T, MinMaxPolicy >::min(), lass::num::norm(), and lass::prim::pointwiseMax().

template<typename T , class MMPa , class MMPb , class MMPr >
Result intersect ( const Aabb3D< T, MMPa > &  a,
const Aabb3D< T, MMPb > &  b,
Aabb3D< T, MMPr > &  result 
) [related]

Calculate the intersection of two axis aligned bounding boxes.

Parameters:
a the first AABB :)
b the second AABB
result the intersection of a and b. In contrary to other intersection functions, this output argument will always be assigned, even if there's no result. By no result we mean: the intersection is empty. For most other intersection functions, we can't assign a meaning full value if there's no intersection, so we don't. However, in this case we can assign an empty AABB. And that's exactly what we do. So, the output argument is always valid, even if the return value suggests otherwise (in fact, you don't have to bother the return value this time)
Returns:
  • rNone intersection of the AABBs is empty. result is an empty AABB.
  • rOne intersection of the AABBs is not empty. result contains intersection.

Definition at line 630 of file aabb_3d.inl.

References lass::prim::Aabb3D< T, MinMaxPolicy >::intersects(), lass::prim::Aabb3D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb3D< T, MinMaxPolicy >::max(), lass::prim::Aabb3D< T, MinMaxPolicy >::min(), lass::prim::pointwiseMax(), lass::prim::pointwiseMin(), lass::prim::rNone, and lass::prim::rOne.

template<typename T , class MMP >
std::ostream & operator<< ( std::ostream &  stream,
const Aabb3D< T, MMP > &  aabb 
) [related]

template<typename T , class MMP >
io::XmlOStream & operator<< ( io::XmlOStream stream,
const Aabb3D< T, MMP > &  aabb 
) [related]

template<typename T >
Aabb3D< T > aabb ( const Parallelogram3D< T > &  parallelogram  )  [related]

determine axis aligned bounding box of a 3D parallelogram

Definition at line 59 of file aabb_3d_parallelogram_3d.h.

References lass::prim::Parallelogram3D< T >::sizeU(), lass::prim::Parallelogram3D< T >::sizeV(), and lass::prim::Parallelogram3D< T >::support().

template<typename T , class EP , class NP >
Aabb3D< T > aabb ( const SimplePolygon3D< T, EP, NP > &  polygon  )  [related]

determine axis aligned bounding box of a 3D simple polygon

Definition at line 59 of file aabb_3d_simple_polygon_3d.h.

References lass::prim::SimplePolygon3D< T, PlaneEquationPolicy, PlaneNormalizingPolicy >::size().

template<typename T , typename MMP >
Sphere3D< T > boundingSphere ( const Aabb3D< T, MMP > &  box  )  [related]

template<typename T , typename MMP >
const bool intersects ( const Aabb3D< T, MMP > &  aabb,
const Sphere3D< T > &  sphere 
) [related]

template<typename T , typename MMP >
const bool collides ( const Aabb3D< T, MMP > &  aabb,
const Sphere3D< T > &  sphere 
) [related]

template<typename T >
Aabb3D< T > aabb ( const Triangle3D< T > &  triangle  )  [related]

determine axis aligned bounding box of a 3D triangle

Definition at line 59 of file aabb_3d_triangle_3d.h.


Field Documentation

template<typename T , class MinMaxPolicy = StrictMinMax>
TPoint lass::prim::Aabb3D< T, MinMaxPolicy >::min_ [private]

template<typename T , class MinMaxPolicy = StrictMinMax>
TPoint lass::prim::Aabb3D< T, MinMaxPolicy >::max_ [private]


The documentation for this class was generated from the following files:

Generated on Mon Nov 10 14:22:13 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo