A 2D bounding box. More...
#include <box2.h>
Public Member Functions | |
box2 () | |
Creates a new, empty bounding box. | |
box2 (type xmin, type xmax, type ymin, type ymax) | |
Creates a new bounding box with the given coordinates. | |
box2 (const vec2< type > &p, const vec2< type > &q) | |
Creates a new bounding box enclosing the two given points. | |
vec2< type > | center () const |
Returns the center of this bounding box. | |
type | width () const |
Returns the width of this bounding box. | |
type | height () const |
Returns the height of this bounding box. | |
type | area () const |
Returns the area of this bounding box. | |
box2 | enlarge (type w) const |
Returns the bounding box containing this box and the given border. | |
box2 | enlarge (const vec2< type > &p) const |
Returns the bounding box containing this box and the given point. | |
box2 | enlarge (const box2 &r) const |
Returns the bounding box containing this box and the given box. | |
bool | contains (const vec2< type > &p) const |
Returns true if this bounding box contains the given point. | |
bool | contains (const box2< type > &bb) const |
Returns true if this bounding box contains the given bounding box. | |
bool | intersects (const box2 &a) const |
Alias for clipRectangle. | |
vec2< type > | nearestInnerPoint (vec2< type > a) const |
Returns the nearest point to a contained in the box. | |
float | distanceTo (vec2< type > a) const |
Returns the minimum distance between the box and a point. | |
float | squaredDistanceTo (vec2< type > a) const |
Returns the squared minimum distance between the box and a point. | |
bool | operator== (const box2 &b) const |
Returns true if this box is equal to the given box. | |
bool | operator!= (const box2 &b) const |
Returns true if this box is different from the given box. | |
Public Attributes | |
type | xmin |
Minimum x coordinate. | |
type | xmax |
Maximum x coordinate. | |
type | ymin |
Minimum y coordinate. | |
type | ymax |
Maximum y coordinate. |
A 2D bounding box.
ork::box2< type >::box2 | ( | type | xmin, | |
type | xmax, | |||
type | ymin, | |||
type | ymax | |||
) | [inline] |
Creates a new bounding box with the given coordinates.
ork::box2< type >::box2 | ( | const vec2< type > & | p, | |
const vec2< type > & | q | |||
) | [inline] |
Creates a new bounding box enclosing the two given points.
type ork::box2< type >::area | ( | ) | const [inline] |
Returns the area of this bounding box.
Returns the center of this bounding box.
bool ork::box2< type >::contains | ( | const box2< type > & | bb | ) | const [inline] |
Returns true if this bounding box contains the given bounding box.
bb | a box2 |
Returns true if this bounding box contains the given point.
p | an arbitrary point. |
Returns the minimum distance between the box and a point.
a | the point |
Returns the bounding box containing this box and the given box.
r | an arbitrary bounding box. |
Returns the bounding box containing this box and the given point.
p | an arbitrary point. |
Returns the bounding box containing this box and the given border.
w | the border to be added to this box. |
type ork::box2< type >::height | ( | ) | const [inline] |
Returns the height of this bounding box.
bool ork::box2< type >::intersects | ( | const box2< type > & | a | ) | const [inline] |
Alias for clipRectangle.
vec2<type> ork::box2< type >::nearestInnerPoint | ( | vec2< type > | a | ) | const [inline] |
Returns the nearest point to a contained in the box.
bool ork::box2< type >::operator!= | ( | const box2< type > & | b | ) | const [inline] |
Returns true if this box is different from the given box.
bool ork::box2< type >::operator== | ( | const box2< type > & | b | ) | const [inline] |
Returns true if this box is equal to the given box.
float ork::box2< type >::squaredDistanceTo | ( | vec2< type > | a | ) | const [inline] |
Returns the squared minimum distance between the box and a point.
a | the point |
type ork::box2< type >::width | ( | ) | const [inline] |
Returns the width of this bounding box.