library of assembled shared sources |
http://lass.cocamware.com |
#include <aabb_2d.h>
Data Structures | |
struct | Rebind |
Public Types | |
enum | { dimension = TPoint::dimension } |
typedef Aabb2D< T, MinMaxPolicy > | TSelf |
typedef MinMaxPolicy | TMinMaxPolicy |
typedef Point2D< T > | TPoint |
typedef Point2DH< 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 | |
Aabb2D () | |
Construct an empty bounding box. | |
Aabb2D (const TPoint &min, const TPoint &max) | |
Construct bounding box, spanned by min and max. | |
Aabb2D (const TPoint &point) | |
Construct bounding box around a single point (min == max). | |
template<class MMP2 > | |
Aabb2D (const Aabb2D< T, MMP2 > &other) | |
copy constructor. | |
const TPoint & | min () const |
return corner with smallest component values | |
const TPoint & | max () 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 > | |
TSelf & | operator= (const Aabb2D< T, MMP2 > &other) |
assign one bounding box to another. | |
TSelf & | operator+= (const TPoint &point) |
Expand bounding box so it contains point. | |
template<class MMP2 > | |
TSelf & | operator+= (const Aabb2D< T, MMP2 > &other) |
Expand bounding box so it contains the other bounding box. | |
void | grow (TParam iDistance) |
Expand bounding box by distance iDistance. | |
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 | perimeter () const |
Returns perimeter of bounding box. | |
const TValue | area () const |
Returns area 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 Aabb2D< 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 Aabb2D< T, MMP2 > &other) const |
Check if two axis-aligned bounding boxes do intersect. | |
template<class MMP2 > | |
const bool | collides (const Aabb2D< 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 (Aabb2D< 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 Aabb2D< T, MMPa > | operator+ (const Aabb2D< T, MMPa > &a, const Aabb2D< T, MMPb > &b) |
join two AABBs | |
template<typename T , class MMP > | |
const Aabb2D< T, MMP > | operator+ (const Aabb2D< T, MMP > &a, const Point2D< T > &b) |
add a point to an AABB | |
template<typename T , class MMP > | |
const Aabb2D< T, MMP > | operator+ (const Point2D< T > &a, const Aabb2D< T, MMP > &b) |
add a point to an AABB | |
template<typename T > | |
const Aabb2D< T > | aabb (const Point2D< T > &point) |
create an aabb with a single point in it | |
template<typename T , class MMP > | |
T | distance (const Aabb2D< T, MMP > &a, const Point2D< T > &b) |
distance between AABB and point | |
template<typename T , class MMPa , class MMPb > | |
T | distance (const Aabb2D< T, MMPa > &a, const Aabb2D< T, MMPb > &b) |
distance between two AABBs | |
template<typename T , class MMPa , class MMPb , class MMPr > | |
Result | intersect (const Aabb2D< T, MMPa > &a, const Aabb2D< T, MMPb > &b, Aabb2D< T, MMPr > &result) |
Calculate the intersection of two axis aligned bounding boxes. | |
template<typename T , typename MMPa , typename MMPb > | |
const bool | intersects (const Aabb2D< T, MMPa > &a, const Aabb2D< T, MMPb > &b) |
template<typename T , typename MMP > | |
const bool | intersects (const Aabb2D< T, MMP > &a, const Point2D< T > &b) |
template<typename T , typename MMP > | |
const bool | intersects (const Point2D< T > &a, const Aabb2D< T, MMP > &b) |
template<typename T , typename MMPa , typename MMPb > | |
const bool | collides (const Aabb2D< T, MMPa > &a, const Aabb2D< T, MMPb > &b) |
template<typename T , typename MMP > | |
const bool | collides (const Aabb2D< T, MMP > &a, const Point2D< T > &b) |
template<typename T , typename MMP > | |
const bool | collides (const Point2D< T > &a, const Aabb2D< T, MMP > &b) |
template<typename T , class MMP > | |
std::ostream & | operator<< (std::ostream &ioOStream, const Aabb2D< T, MMP > &aabb) |
template<typename T , class MMP > | |
io::XmlOStream & | operator<< (io::XmlOStream &ioOStream, const Aabb2D< T, MMP > &aabb) |
template<typename T , class MMP > | |
io::MatlabOStream & | operator<< (io::MatlabOStream &ioOStream, const Aabb2D< T, MMP > &aabb) |
template<typename T , class DegeneratePolicy > | |
Aabb2D< T > | aabb (const SimplePolygon2D< T, DegeneratePolicy > &polygon) |
determine axis aligned bounding box of a 2D simple polygon | |
template<typename T , typename MMP > | |
const bool | intersects (const Aabb3D< T, MMP > &a, const Point3D< T > &b) |
template<typename T , typename MMP > | |
const bool | intersects (const Point3D< T > &a, const Aabb3D< T, MMP > &b) |
template<typename T , typename MMP > | |
const bool | collides (const Aabb3D< T, MMP > &a, const Point3D< T > &b) |
template<typename T , typename MMP > | |
const bool | collides (const Point3D< T > &a, const Aabb3D< T, MMP > &b) |
"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_2d.h.
typedef Aabb2D<T, MinMaxPolicy> lass::prim::Aabb2D< T, MinMaxPolicy >::TSelf |
typedef MinMaxPolicy lass::prim::Aabb2D< T, MinMaxPolicy >::TMinMaxPolicy |
typedef Point2D<T> lass::prim::Aabb2D< T, MinMaxPolicy >::TPoint |
typedef Point2DH<T> lass::prim::Aabb2D< T, MinMaxPolicy >::TPointH |
typedef TPoint::TVector lass::prim::Aabb2D< T, MinMaxPolicy >::TVector |
typedef TPoint::TValue lass::prim::Aabb2D< T, MinMaxPolicy >::TValue |
typedef TPoint::TParam lass::prim::Aabb2D< T, MinMaxPolicy >::TParam |
typedef TPoint::TReference lass::prim::Aabb2D< T, MinMaxPolicy >::TReference |
typedef TPoint::TConstReference lass::prim::Aabb2D< T, MinMaxPolicy >::TConstReference |
typedef TPoint::TNumTraits lass::prim::Aabb2D< T, MinMaxPolicy >::TNumTraits |
anonymous enum |
lass::prim::Aabb2D< T, MMP >::Aabb2D | ( | ) | [inline] |
Construct an empty bounding box.
Definition at line 63 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isEmpty(), and LASS_ASSERT.
lass::prim::Aabb2D< T, MMP >::Aabb2D | ( | const TPoint & | min, | |
const TPoint & | max | |||
) | [inline] |
Construct bounding box, spanned by min and max.
Definition at line 75 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max_, and lass::prim::Aabb2D< T, MinMaxPolicy >::min_.
lass::prim::Aabb2D< T, MMP >::Aabb2D | ( | const TPoint & | point | ) | [inline, explicit] |
Construct bounding box around a single point (min == max).
Definition at line 88 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), and LASS_ASSERT.
lass::prim::Aabb2D< T, MMP >::Aabb2D | ( | const Aabb2D< T, MMP2 > & | other | ) | [inline] |
copy constructor.
Definition at line 101 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), and LASS_ASSERT.
const Aabb2D< T, MMP >::TPoint & lass::prim::Aabb2D< T, MMP >::min | ( | ) | const [inline] |
return corner with smallest component values
Definition at line 114 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, and lass::prim::Aabb2D< T, MinMaxPolicy >::min_.
Referenced by lass::prim::collides(), lass::prim::Aabb2D< T, MinMaxPolicy >::collides(), lass::prim::Aabb2D< T, MinMaxPolicy >::contains(), lass::prim::Aabb2D< T, MinMaxPolicy >::distance(), lass::prim::Ray2D< T, NormalizingPolicy, ParameterPolicy >::intersect(), lass::prim::Aabb2D< T, MinMaxPolicy >::intersect(), lass::prim::intersects(), lass::spat::LinearMeshInterpolator< T, TPI >::LinearMeshInterpolator(), lass::prim::Aabb2D< T, MinMaxPolicy >::operator+=(), lass::prim::Aabb3D< T, MinMaxPolicy >::operator<<(), lass::prim::Aabb2D< T, MinMaxPolicy >::operator<<(), lass::spat::PlanarMesh::PlanarMesh(), and lass::prim::Transformation3D< T >::transform().
const Aabb2D< T, MMP >::TPoint & lass::prim::Aabb2D< T, MMP >::max | ( | ) | const [inline] |
Return corner with largest component values.
Definition at line 126 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, and lass::prim::Aabb2D< T, MinMaxPolicy >::max_.
Referenced by lass::prim::collides(), lass::prim::Aabb2D< T, MinMaxPolicy >::collides(), lass::prim::Aabb2D< T, MinMaxPolicy >::contains(), lass::prim::Aabb2D< T, MinMaxPolicy >::distance(), lass::prim::Ray2D< T, NormalizingPolicy, ParameterPolicy >::intersect(), lass::prim::Aabb2D< T, MinMaxPolicy >::intersect(), lass::prim::intersects(), lass::spat::LinearMeshInterpolator< T, TPI >::LinearMeshInterpolator(), lass::prim::Aabb2D< T, MinMaxPolicy >::operator+=(), lass::prim::Aabb3D< T, MinMaxPolicy >::operator<<(), lass::prim::Aabb2D< T, MinMaxPolicy >::operator<<(), and lass::spat::PlanarMesh::PlanarMesh().
void lass::prim::Aabb2D< T, MMP >::setMin | ( | const TPoint & | min | ) | [inline] |
set corner with smallest component values
Definition at line 137 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isEmpty(), lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max_, and lass::prim::Aabb2D< T, MinMaxPolicy >::min_.
void lass::prim::Aabb2D< T, MMP >::setMax | ( | const TPoint & | max | ) | [inline] |
set corner with larges component values
Definition at line 156 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isEmpty(), lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max_, and lass::prim::Aabb2D< T, MinMaxPolicy >::min_.
Aabb2D< T, MMP >::TSelf & lass::prim::Aabb2D< T, MMP >::operator= | ( | const Aabb2D< T, MMP2 > & | other | ) | [inline] |
assign one bounding box to another.
Definition at line 177 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::swap().
Aabb2D< T, MMP >::TSelf & lass::prim::Aabb2D< T, MMP >::operator+= | ( | const TPoint & | point | ) | [inline] |
Expand bounding box so it contains point.
Definition at line 190 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max_, lass::prim::Aabb2D< T, MinMaxPolicy >::min_, lass::prim::pointwiseMax(), and lass::prim::pointwiseMin().
Aabb2D< T, MMP >::TSelf & lass::prim::Aabb2D< T, MMP >::operator+= | ( | const Aabb2D< T, MMP2 > & | other | ) | [inline] |
Expand bounding box so it contains the other bounding box.
Definition at line 205 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max(), lass::prim::Aabb2D< T, MinMaxPolicy >::max_, lass::prim::Aabb2D< T, MinMaxPolicy >::min(), lass::prim::Aabb2D< T, MinMaxPolicy >::min_, lass::prim::pointwiseMax(), and lass::prim::pointwiseMin().
void lass::prim::Aabb2D< 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 219 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::clear(), lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max_, lass::prim::Aabb2D< T, MinMaxPolicy >::min_, lass::prim::Point2D< T >::x, and lass::prim::Point2D< T >::y.
void lass::prim::Aabb2D< 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 239 of file aabb_2d.inl.
References lass::num::abs(), lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max_, lass::prim::Aabb2D< T, MinMaxPolicy >::min_, and lass::prim::Aabb2D< T, MinMaxPolicy >::size().
const Aabb2D< T, MMP >::TPointH lass::prim::Aabb2D< 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 255 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max_, and lass::prim::Aabb2D< T, MinMaxPolicy >::min_.
Referenced by lass::prim::Aabb2D< T, MinMaxPolicy >::collides(), and lass::prim::Aabb2D< T, MinMaxPolicy >::intersects().
const Aabb2D< T, MMP >::TVector lass::prim::Aabb2D< T, MMP >::size | ( | ) | const [inline] |
Return size of bounding box per axis, max - min.
Definition at line 267 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max_, and lass::prim::Aabb2D< T, MinMaxPolicy >::min_.
Referenced by lass::prim::Aabb2D< T, MinMaxPolicy >::area(), lass::prim::Aabb2D< T, MinMaxPolicy >::collides(), lass::prim::Aabb2D< T, MinMaxPolicy >::intersects(), lass::prim::Aabb2D< T, MinMaxPolicy >::perimeter(), lass::prim::Aabb2D< T, MinMaxPolicy >::scale(), and lass::prim::Transformation3D< T >::transform().
const Aabb2D< T, MMP >::TValue lass::prim::Aabb2D< T, MMP >::perimeter | ( | ) | const [inline] |
Returns perimeter of bounding box.
Definition at line 279 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::size(), lass::prim::Vector2D< T >::x, and lass::prim::Vector2D< T >::y.
const Aabb2D< T, MMP >::TValue lass::prim::Aabb2D< T, MMP >::area | ( | ) | const [inline] |
Returns area of bounding box.
Definition at line 292 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::size(), lass::prim::Vector2D< T >::x, and lass::prim::Vector2D< T >::y.
const Side lass::prim::Aabb2D< T, MMP >::classify | ( | const TPoint & | point | ) | const [inline] |
Classify if a point is in or outside the bounding box, or on its surface.
Definition at line 304 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max_, lass::prim::Aabb2D< T, MinMaxPolicy >::min_, lass::prim::sInside, lass::prim::sOutside, lass::prim::sSurface, lass::prim::Point2D< T >::x, and lass::prim::Point2D< T >::y.
const bool lass::prim::Aabb2D< T, MMP >::contains | ( | const TPoint & | point | ) | const [inline] |
Returns true if point is inside bounding box or on its surface.
Is equivalent to this->classify(point) != sOutside, but might be faster.
Definition at line 329 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max_, lass::prim::Aabb2D< T, MinMaxPolicy >::min_, lass::prim::Point2D< T >::x, and lass::prim::Point2D< T >::y.
Referenced by lass::spat::MeshInterpolator< T, TPI >::insertPolyLine(), lass::spat::MeshInterpolator< T, TPI >::insertSite(), lass::prim::Aabb2D< T, MinMaxPolicy >::intersects(), and lass::prim::Aabb2D< T, MinMaxPolicy >::random().
const bool lass::prim::Aabb2D< T, MMP >::contains | ( | const Aabb2D< T, MMP2 > & | other | ) | const [inline] |
Returns true if the AABB other is inside (or on its surface) this AABB.
Definition at line 345 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max(), lass::prim::Aabb2D< T, MinMaxPolicy >::max_, lass::prim::Aabb2D< T, MinMaxPolicy >::min(), lass::prim::Aabb2D< T, MinMaxPolicy >::min_, lass::prim::Point2D< T >::x, and lass::prim::Point2D< T >::y.
const bool lass::prim::Aabb2D< T, MMP >::intersects | ( | const Aabb2D< T, MMP2 > & | other | ) | const [inline] |
Check if two axis-aligned bounding boxes do intersect.
this->intersects
(other) and this->collides
(other) ?area()==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 area. 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.Definition at line 375 of file aabb_2d.inl.
References lass::num::abs(), lass::prim::Aabb2D< T, MinMaxPolicy >::center(), lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::size(), lass::prim::Point2DH< T >::weight(), lass::prim::Vector2D< T >::x, and lass::prim::Vector2D< T >::y.
Referenced by lass::prim::Aabb2D< T, MinMaxPolicy >::intersect(), lass::prim::intersects(), and lass::prim::Aabb2D< T, MinMaxPolicy >::intersects().
const bool lass::prim::Aabb2D< T, MMP >::collides | ( | const Aabb2D< T, MMP2 > & | other | ) | const [inline] |
Check if two axis-aligned bounding boxes do dollide.
this->intersects
(other) and this->collides
(other) ?area()==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 area. 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.Definition at line 418 of file aabb_2d.inl.
References lass::num::abs(), lass::prim::Aabb2D< T, MinMaxPolicy >::center(), lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::size(), lass::prim::Point2DH< T >::weight(), lass::prim::Vector2D< T >::x, and lass::prim::Vector2D< T >::y.
Referenced by lass::prim::collides(), and lass::prim::Aabb2D< T, MinMaxPolicy >::collides().
const Aabb2D< T, MMP >::TPoint lass::prim::Aabb2D< T, MMP >::random | ( | RandomGenerator & | random | ) | const [inline] |
Return a random point so that bounding box contains it.
Definition at line 445 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::contains(), lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max_, lass::prim::Aabb2D< T, MinMaxPolicy >::min_, and lass::num::uniform().
void lass::prim::Aabb2D< T, MMP >::clear | ( | ) | [inline] |
set AABB to an empty box
Definition at line 460 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isEmpty(), lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::num::NumTraits< C >::max, lass::prim::Aabb2D< T, MinMaxPolicy >::max_, lass::num::NumTraits< C >::min, and lass::prim::Aabb2D< T, MinMaxPolicy >::min_.
Referenced by lass::prim::Aabb2D< T, MinMaxPolicy >::grow().
const bool lass::prim::Aabb2D< T, MMP >::isEmpty | ( | ) | const [inline] |
Return true if bounding box contains no points.
i.e. this->contains(Point3D<T>(x, y, z)) will return false for all possible values of x, y and z.
Definition at line 474 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max_, lass::prim::Aabb2D< T, MinMaxPolicy >::min_, and lass::prim::Point2D< T >::x.
Referenced by lass::prim::Aabb2D< T, MinMaxPolicy >::Aabb2D(), lass::prim::Aabb2D< T, MinMaxPolicy >::clear(), lass::prim::Aabb2D< T, MinMaxPolicy >::distance(), lass::prim::Ray2D< T, NormalizingPolicy, ParameterPolicy >::intersect(), lass::prim::Aabb2D< T, MinMaxPolicy >::setMax(), lass::prim::Aabb2D< T, MinMaxPolicy >::setMin(), and lass::prim::Transformation3D< T >::transform().
const bool lass::prim::Aabb2D< 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
which means the box is not empty. That gives us an invalid state as well: max_.x >= min_.x && max_.y < min_.y
. 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.Definition at line 496 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::max_, lass::prim::Aabb2D< T, MinMaxPolicy >::min_, lass::prim::Point2D< T >::x, and lass::prim::Point2D< T >::y.
Referenced by lass::prim::Aabb2D< T, MinMaxPolicy >::Aabb2D(), lass::prim::Aabb2D< T, MinMaxPolicy >::area(), lass::prim::Aabb2D< T, MinMaxPolicy >::center(), lass::prim::Aabb2D< T, MinMaxPolicy >::classify(), lass::prim::Aabb2D< T, MinMaxPolicy >::clear(), lass::prim::Aabb2D< T, MinMaxPolicy >::collides(), lass::prim::Aabb2D< T, MinMaxPolicy >::contains(), lass::prim::Aabb2D< T, MinMaxPolicy >::grow(), lass::prim::Aabb2D< T, MinMaxPolicy >::intersect(), lass::prim::Aabb2D< T, MinMaxPolicy >::intersects(), lass::prim::Aabb2D< T, MinMaxPolicy >::isEmpty(), lass::prim::Aabb2D< T, MinMaxPolicy >::max(), lass::prim::Aabb2D< T, MinMaxPolicy >::min(), lass::prim::Aabb2D< T, MinMaxPolicy >::operator+=(), lass::prim::Aabb2D< T, MinMaxPolicy >::perimeter(), lass::prim::Aabb2D< T, MinMaxPolicy >::random(), lass::prim::Aabb2D< T, MinMaxPolicy >::scale(), lass::prim::Aabb2D< T, MinMaxPolicy >::setMax(), lass::prim::Aabb2D< T, MinMaxPolicy >::setMin(), lass::prim::Aabb2D< T, MinMaxPolicy >::size(), and lass::prim::Aabb2D< T, MinMaxPolicy >::swap().
void lass::prim::Aabb2D< T, MMP >::swap | ( | Aabb2D< T, MMP2 > & | other | ) | [inline] |
swap two bounding boxes.
Definition at line 507 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max_, and lass::prim::Aabb2D< T, MinMaxPolicy >::min_.
Referenced by lass::prim::Aabb2D< T, MinMaxPolicy >::operator=().
T distance | ( | const Aabb2D< T, MMP > & | a, | |
const Point2D< T > & | b | |||
) | [related] |
distance between AABB and point
a | AABB | |
b | point |
Definition at line 576 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isEmpty(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max(), lass::prim::Aabb2D< T, MinMaxPolicy >::min(), lass::num::norm(), and lass::prim::pointwiseMax().
T distance | ( | const Aabb2D< T, MMPa > & | a, | |
const Aabb2D< T, MMPb > & | b | |||
) | [related] |
distance between two AABBs
a | AABB | |
b | AABB |
Definition at line 593 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::isEmpty(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max(), lass::prim::Aabb2D< T, MinMaxPolicy >::min(), lass::num::norm(), and lass::prim::pointwiseMax().
Result intersect | ( | const Aabb2D< T, MMPa > & | a, | |
const Aabb2D< T, MMPb > & | b, | |||
Aabb2D< T, MMPr > & | result | |||
) | [related] |
Calculate the intersection of two axis aligned bounding boxes.
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) |
Definition at line 620 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::intersects(), lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), LASS_ASSERT, lass::prim::Aabb2D< T, MinMaxPolicy >::max(), lass::prim::Aabb2D< T, MinMaxPolicy >::min(), lass::prim::pointwiseMax(), lass::prim::pointwiseMin(), lass::prim::rNone, and lass::prim::rOne.
const bool intersects | ( | const Aabb2D< T, MMPa > & | a, | |
const Aabb2D< T, MMPb > & | b | |||
) | [related] |
Definition at line 642 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::intersects().
const bool intersects | ( | const Aabb2D< T, MMP > & | a, | |
const Point2D< T > & | b | |||
) | [related] |
Definition at line 652 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::contains().
const bool intersects | ( | const Point2D< T > & | a, | |
const Aabb2D< T, MMP > & | b | |||
) | [related] |
Definition at line 662 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::contains().
const bool collides | ( | const Aabb2D< T, MMPa > & | a, | |
const Aabb2D< T, MMPb > & | b | |||
) | [related] |
Definition at line 672 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::collides().
const bool collides | ( | const Aabb2D< T, MMP > & | a, | |
const Point2D< T > & | b | |||
) | [related] |
Definition at line 682 of file aabb_2d.inl.
References lass::prim::Aabb2D< T, MinMaxPolicy >::max(), lass::prim::Aabb2D< T, MinMaxPolicy >::min(), lass::prim::Point2D< T >::x, and lass::prim::Point2D< T >::y.
std::ostream & operator<< | ( | std::ostream & | ioOStream, | |
const Aabb2D< T, MMP > & | aabb | |||
) | [related] |
Definition at line 705 of file aabb_2d.inl.
References lass::prim::aabb(), LASS_ENFORCE_STREAM, lass::prim::Aabb2D< T, MinMaxPolicy >::max(), and lass::prim::Aabb2D< T, MinMaxPolicy >::min().
io::XmlOStream & operator<< | ( | io::XmlOStream & | ioOStream, | |
const Aabb2D< T, MMP > & | aabb | |||
) | [related] |
Definition at line 716 of file aabb_2d.inl.
References lass::prim::aabb(), LASS_ENFORCE_STREAM, lass::prim::Aabb2D< T, MinMaxPolicy >::max(), and lass::prim::Aabb2D< T, MinMaxPolicy >::min().
io::MatlabOStream & operator<< | ( | io::MatlabOStream & | ioOStream, | |
const Aabb2D< T, MMP > & | aabb | |||
) | [related] |
Definition at line 732 of file aabb_2d.inl.
References lass::prim::aabb(), lass::prim::Aabb2D< T, MinMaxPolicy >::max(), lass::prim::Aabb2D< T, MinMaxPolicy >::min(), lass::prim::Point2D< T >::x, and lass::prim::Point2D< T >::y.
Aabb2D< T > aabb | ( | const SimplePolygon2D< T, DegeneratePolicy > & | polygon | ) | [related] |
determine axis aligned bounding box of a 2D simple polygon
Definition at line 59 of file aabb_2d_simple_polygon_2d.h.
References lass::prim::SimplePolygon2D< T, DegeneratePolicy >::size().
const bool intersects | ( | const Aabb3D< T, MMP > & | a, | |
const Point3D< T > & | b | |||
) | [related] |
Definition at line 660 of file aabb_3d.inl.
References lass::prim::Aabb3D< T, MinMaxPolicy >::contains().
const bool intersects | ( | const Point3D< T > & | a, | |
const Aabb3D< T, MMP > & | b | |||
) | [related] |
Definition at line 670 of file aabb_3d.inl.
References lass::prim::Aabb3D< T, MinMaxPolicy >::contains().
TPoint lass::prim::Aabb2D< T, MinMaxPolicy >::min_ [private] |
Definition at line 150 of file aabb_2d.h.
Referenced by lass::prim::Aabb2D< T, MinMaxPolicy >::Aabb2D(), lass::prim::Aabb2D< T, MinMaxPolicy >::center(), lass::prim::Aabb2D< T, MinMaxPolicy >::classify(), lass::prim::Aabb2D< T, MinMaxPolicy >::clear(), lass::prim::Aabb2D< T, MinMaxPolicy >::contains(), lass::prim::Aabb2D< T, MinMaxPolicy >::grow(), lass::prim::Aabb2D< T, MinMaxPolicy >::isEmpty(), lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), lass::prim::Aabb2D< T, MinMaxPolicy >::min(), lass::prim::Aabb2D< T, MinMaxPolicy >::operator+=(), lass::prim::Aabb2D< T, MinMaxPolicy >::random(), lass::prim::Aabb2D< T, MinMaxPolicy >::scale(), lass::prim::Aabb2D< T, MinMaxPolicy >::setMax(), lass::prim::Aabb2D< T, MinMaxPolicy >::setMin(), lass::prim::Aabb2D< T, MinMaxPolicy >::size(), and lass::prim::Aabb2D< T, MinMaxPolicy >::swap().
TPoint lass::prim::Aabb2D< T, MinMaxPolicy >::max_ [private] |
Definition at line 151 of file aabb_2d.h.
Referenced by lass::prim::Aabb2D< T, MinMaxPolicy >::Aabb2D(), lass::prim::Aabb2D< T, MinMaxPolicy >::center(), lass::prim::Aabb2D< T, MinMaxPolicy >::classify(), lass::prim::Aabb2D< T, MinMaxPolicy >::clear(), lass::prim::Aabb2D< T, MinMaxPolicy >::contains(), lass::prim::Aabb2D< T, MinMaxPolicy >::grow(), lass::prim::Aabb2D< T, MinMaxPolicy >::isEmpty(), lass::prim::Aabb2D< T, MinMaxPolicy >::isValid(), lass::prim::Aabb2D< T, MinMaxPolicy >::max(), lass::prim::Aabb2D< T, MinMaxPolicy >::operator+=(), lass::prim::Aabb2D< T, MinMaxPolicy >::random(), lass::prim::Aabb2D< T, MinMaxPolicy >::scale(), lass::prim::Aabb2D< T, MinMaxPolicy >::setMax(), lass::prim::Aabb2D< T, MinMaxPolicy >::setMin(), lass::prim::Aabb2D< T, MinMaxPolicy >::size(), and lass::prim::Aabb2D< T, MinMaxPolicy >::swap().
Generated on Mon Nov 10 14:22:13 2008 for Library of Assembled Shared Sources by 1.5.7.1 |