Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
BoundingBox< N, T > Class Template ReferenceBounding box of a shape; used for coordinate calculations. More...
Inheritance diagram for BoundingBox< N, T >:
Detailed Descriptiontemplate<size_t N, typename T = fmat::fmatReal>
|
Public Member Functions | |
BoundingBox () | |
Constructor, defaults to empty bounding box (aka ALL_EXCLUSIVE). | |
BoundingBox (T xmin, T ymin, T xmax, T ymax) | |
Constructor for 2D boxes. | |
template<typename R > | |
BoundingBox (const BoundingBox< N, R > &bb) | |
Conversion between types (same dimensionality). | |
template<size_t D, typename R > | |
BoundingBox (const BoundingBox< D, R > &bb, bool inclusive=true) | |
Conversion between type/dimensions. | |
template<class P > | |
BoundingBox (const P &p) | |
Constructor for single-point box (note collision requires non-zero area). | |
template<class P > | |
BoundingBox (const P &_min, const P &_max) | |
Constructor, specify min/max directly (you are responsible to ensure min << max). | |
bool | empty () const |
Returns true if box has zero or negative area. | |
void | clear () |
Sets min and max to default values (negative infinite area). | |
T | getDimension (size_t x) const |
Return the width of dimenion x (Cowabunga Dude!). | |
fmat::Column< N, T > | getDimensions () const |
Return the width of each dimension. | |
fmat::Column< N, T > | getCenter () const |
Returns the center of the bounding box. | |
fmat::Column< N, T > | getRandom () const |
Returns a random point within the bounding box (including edges). | |
template<class R > | |
void | expand (const fmat::Column< N, R > &p) |
Expand the bounding box to include p. | |
template<class R > | |
void | expand (const fmat::SubVector< N, R > &p) |
Expand the bounding box to include p. | |
template<class P > | |
void | expand (const P &p) |
Expand the bounding box to include p. | |
void | expand (const BoundingBox &bb) |
Expand the bounding box to include bb. | |
void | rotate (fmat::Matrix< N, N > r) |
Applies the specified rotation about the bounding box center, then resets to the axis-aligned boundaries of the rotated bounding box. | |
void | translate (const fmat::Column< N > &x) |
Translates the bounding box, moving the min and max bounds. | |
void | transform (const fmat::Matrix< N, N > &r, const fmat::Column< N > &x) |
void | recenter (const fmat::Column< N > &c) |
Translates the bounding box, moving the min and max bounds such that the center is placed at c. | |
template<class P > | |
bool | collides (const P &p) const |
Return true if this box includes p (note edge coincidence does not count). | |
bool | collides (const BoundingBox &bb) const |
Return true if this box intersects p (note edge coincidence does not count). | |
fmat::Column< N, T > | getCorner (size_t x) const |
Returns a corner of the box as determined by which bits are set. | |
bool | operator== (const BoundingBox &bb) const |
bool | operator!= (const BoundingBox &bb) const |
Public Attributes | |
fmat::Column< N, T > | min |
minimum corner | |
fmat::Column< N, T > | max |
maximum corner | |
Static Public Attributes | |
static const BoundingBox | ALL_INCLUSIVE |
a bounding box initialized to contain everything: (-∞,∞) | |
static const BoundingBox | ALL_EXCLUSIVE |
a bounding box initialized to exclude everything: (∞,-∞) — this is also default construction | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const BoundingBox &bb) |
For display/serialization. |
BoundingBox< N, T >::BoundingBox | ( | ) |
Constructor, defaults to empty bounding box (aka ALL_EXCLUSIVE).
Using inverted infinities, so no point should collide, and any expansion will collapse to the expansion.
Definition at line 22 of file BoundingBox.h.
BoundingBox< N, T >::BoundingBox | ( | T | xmin, | |
T | ymin, | |||
T | xmax, | |||
T | ymax | |||
) |
Constructor for 2D boxes.
Definition at line 27 of file BoundingBox.h.
BoundingBox< N, T >::BoundingBox | ( | const BoundingBox< N, R > & | bb | ) |
Conversion between types (same dimensionality).
Definition at line 31 of file BoundingBox.h.
BoundingBox< N, T >::BoundingBox | ( | const BoundingBox< D, R > & | bb, | |
bool | inclusive = true | |||
) | [explicit] |
Conversion between type/dimensions.
If inclusive is set and this is an 'upcast' (D < N), extra dimensions will be set to all-inclusive (-∞,∞). Otherwise, extra dimensions will be set to all-exclusive (∞,-∞) and you would need to provide additional expansion in order to form a positive volume.
Definition at line 37 of file BoundingBox.h.
BoundingBox< N, T >::BoundingBox | ( | const P & | p | ) | [explicit] |
Constructor for single-point box (note collision requires non-zero area).
Definition at line 47 of file BoundingBox.h.
BoundingBox< N, T >::BoundingBox | ( | const P & | _min, | |
const P & | _max | |||
) | [explicit] |
Constructor, specify min/max directly (you are responsible to ensure min << max).
Definition at line 50 of file BoundingBox.h.
void BoundingBox< N, T >::clear | ( | ) |
Sets min and max to default values (negative infinite area).
Definition at line 56 of file BoundingBox.h.
Referenced by LinkComponent::computeOwnAABB().
bool BoundingBox< N, T >::collides | ( | const BoundingBox< N, T > & | bb | ) | const |
Return true if this box intersects p (note edge coincidence does not count).
Definition at line 146 of file BoundingBox.h.
bool BoundingBox< N, T >::collides | ( | const P & | p | ) | const |
Return true if this box includes p (note edge coincidence does not count).
Definition at line 141 of file BoundingBox.h.
Referenced by HierarchicalObstacle::collides(), and RectangularObstacle::collides().
bool BoundingBox< N, T >::empty | ( | ) | const |
Returns true if box has zero or negative area.
Definition at line 53 of file BoundingBox.h.
Referenced by LinkComponent::getBB2D(), and LinkComponent::getBB3D().
void BoundingBox< N, T >::expand | ( | const BoundingBox< N, T > & | bb | ) |
Expand the bounding box to include bb.
Definition at line 99 of file BoundingBox.h.
void BoundingBox< N, T >::expand | ( | const P & | p | ) |
Expand the bounding box to include p.
This version picks up extended-dimenion points, arrays, and column subclasses, converting to a SubVector intermediary. Allows implicit truncation of 3D to 2D, since this is pretty commonly used in DualCoding.
Definition at line 93 of file BoundingBox.h.
void BoundingBox< N, T >::expand | ( | const fmat::SubVector< N, R > & | p | ) |
Expand the bounding box to include p.
This picks up subvectors of the correct size
Definition at line 88 of file BoundingBox.h.
void BoundingBox< N, T >::expand | ( | const fmat::Column< N, R > & | p | ) |
Expand the bounding box to include p.
This picks up columns of the correct size
Definition at line 84 of file BoundingBox.h.
Referenced by HierarchicalObstacle::expandBoundingBox(), ShapeSpaceCollisionCheckerBase< N >::getBodyBoundingBox(), ConvexPolyObstacle::getBoundingBox(), EllipticalObstacle::getBoundingBox(), ShapeSpaceCollisionCheckerBase< N >::getObstacleBoundingBox(), ShapeSpacePlannerXYTheta::planPath(), and KinematicJoint::updateBB().
fmat::Column<N,T> BoundingBox< N, T >::getCenter | ( | ) | const |
Returns the center of the bounding box.
Definition at line 65 of file BoundingBox.h.
Referenced by BoxObstacle::BoxObstacle(), LinkComponent::getBB2D(), LinkComponent::getBB3D(), RectangularObstacle::RectangularObstacle(), BoundingBox< 3 >::rotate(), Draw::setRegion(), and BoundingBox< 3 >::transform().
fmat::Column<N,T> BoundingBox< N, T >::getCorner | ( | size_t | x | ) | const |
Returns a corner of the box as determined by which bits are set.
The ith bit corresponds to the ith axis, 0 returns lower bound, and 1 returns upper bound
Definition at line 160 of file BoundingBox.h.
T BoundingBox< N, T >::getDimension | ( | size_t | x | ) | const |
Return the width of dimenion x (Cowabunga Dude!).
Definition at line 59 of file BoundingBox.h.
Referenced by Draw::setRegion().
fmat::Column<N,T> BoundingBox< N, T >::getDimensions | ( | ) | const |
Return the width of each dimension.
Definition at line 62 of file BoundingBox.h.
Referenced by BoxObstacle::BoxObstacle(), LinkComponent::getBB2D(), LinkComponent::getBB3D(), BoundingBox< 3 >::recenter(), and RectangularObstacle::RectangularObstacle().
fmat::Column<N,T> BoundingBox< N, T >::getRandom | ( | ) | const |
Returns a random point within the bounding box (including edges).
Definition at line 68 of file BoundingBox.h.
bool BoundingBox< N, T >::operator!= | ( | const BoundingBox< N, T > & | bb | ) | const |
Definition at line 185 of file BoundingBox.h.
bool BoundingBox< N, T >::operator== | ( | const BoundingBox< N, T > & | bb | ) | const |
Definition at line 182 of file BoundingBox.h.
void BoundingBox< N, T >::recenter | ( | const fmat::Column< N > & | c | ) |
Translates the bounding box, moving the min and max bounds such that the center is placed at c.
Definition at line 134 of file BoundingBox.h.
Referenced by BoundingBox< 3 >::transform().
void BoundingBox< N, T >::rotate | ( | fmat::Matrix< N, N > | r | ) |
Applies the specified rotation about the bounding box center, then resets to the axis-aligned boundaries of the rotated bounding box.
This does not handle bounding boxes with infinite bounds.
Definition at line 106 of file BoundingBox.h.
Referenced by BoundingBox< 3 >::transform().
void BoundingBox< N, T >::transform | ( | const fmat::Matrix< N, N > & | r, | |
const fmat::Column< N > & | x | |||
) |
Definition at line 128 of file BoundingBox.h.
void BoundingBox< N, T >::translate | ( | const fmat::Column< N > & | x | ) |
Translates the bounding box, moving the min and max bounds.
Definition at line 123 of file BoundingBox.h.
std::ostream& operator<< | ( | std::ostream & | out, | |
const BoundingBox< N, T > & | bb | |||
) | [friend] |
For display/serialization.
Definition at line 171 of file BoundingBox.h.
const BoundingBox< N, T > BoundingBox< N, T >::ALL_EXCLUSIVE [static] |
a bounding box initialized to exclude everything: (∞,-∞) — this is also default construction
Definition at line 14 of file BoundingBox.h.
const BoundingBox< N, T > BoundingBox< N, T >::ALL_INCLUSIVE [static] |
a bounding box initialized to contain everything: (-∞,∞)
Definition at line 13 of file BoundingBox.h.
fmat::Column<N,T> BoundingBox< N, T >::max |
maximum corner
Definition at line 17 of file BoundingBox.h.
Referenced by BoundingBox< 3 >::BoundingBox(), BoundingBox< 3 >::clear(), BoundingBox< 3 >::collides(), LinkComponent::computeOwnAABB(), BoundingBox< 3 >::empty(), BoundingBox< 3 >::expand(), BoundingBox< 3 >::getCenter(), BoundingBox< 3 >::getCorner(), BoundingBox< 3 >::getDimension(), BoundingBox< 3 >::getDimensions(), BoundingBox< 3 >::getRandom(), BoundingBox< 3 >::operator!=(), BoundingBox< 3 >::operator==(), ShapeSpacePlannerXYTheta::planPath(), ShapeSpacePlannerXY::planPath(), BoundingBox< 3 >::recenter(), Draw::rect(), BoxObstacle::reset(), RectangularObstacle::reset(), BoundingBox< 3 >::rotate(), BoundingBox< 3 >::translate(), BoxObstacle::updatePosition(), HierarchicalObstacle::updatePosition(), and RectangularObstacle::updatePosition().
fmat::Column<N,T> BoundingBox< N, T >::min |
minimum corner
Definition at line 16 of file BoundingBox.h.
Referenced by BoundingBox< 3 >::BoundingBox(), BoundingBox< 3 >::clear(), BoundingBox< 3 >::collides(), LinkComponent::computeOwnAABB(), BoundingBox< 3 >::empty(), BoundingBox< 3 >::expand(), BoundingBox< 3 >::getCenter(), BoundingBox< 3 >::getCorner(), BoundingBox< 3 >::getDimension(), BoundingBox< 3 >::getDimensions(), BoundingBox< 3 >::getRandom(), BoundingBox< 3 >::operator!=(), BoundingBox< 3 >::operator==(), ShapeSpacePlannerXYTheta::planPath(), ShapeSpacePlannerXY::planPath(), BoundingBox< 3 >::recenter(), Draw::rect(), BoxObstacle::reset(), RectangularObstacle::reset(), BoundingBox< 3 >::rotate(), BoundingBox< 3 >::translate(), BoxObstacle::updatePosition(), HierarchicalObstacle::updatePosition(), and RectangularObstacle::updatePosition().
Tekkotsu v5.1CVS |
Generated Mon May 9 04:59:05 2016 by Doxygen 1.6.3 |