ork::box2< type > Struct Template Reference
[math]

A 2D bounding box. More...

#include <box2.h>

List of all members.

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.

Detailed Description

template<typename type>
struct ork::box2< type >

A 2D bounding box.


Constructor & Destructor Documentation

template<typename type >
ork::box2< type >::box2 (  )  [inline]

Creates a new, empty bounding box.

template<typename type >
ork::box2< type >::box2 ( type  xmin,
type  xmax,
type  ymin,
type  ymax 
) [inline]

Creates a new bounding box with the given coordinates.

template<typename type >
ork::box2< type >::box2 ( const vec2< type > &  p,
const vec2< type > &  q 
) [inline]

Creates a new bounding box enclosing the two given points.


Member Function Documentation

template<typename type >
type ork::box2< type >::area (  )  const [inline]

Returns the area of this bounding box.

template<typename type >
vec2<type> ork::box2< type >::center (  )  const [inline]

Returns the center of this bounding box.

template<typename type >
bool ork::box2< type >::contains ( const box2< type > &  bb  )  const [inline]

Returns true if this bounding box contains the given bounding box.

Parameters:
bb a box2
template<typename type >
bool ork::box2< type >::contains ( const vec2< type > &  p  )  const [inline]

Returns true if this bounding box contains the given point.

Parameters:
p an arbitrary point.
template<typename type >
float ork::box2< type >::distanceTo ( vec2< type >  a  )  const [inline]

Returns the minimum distance between the box and a point.

Parameters:
a the point
template<typename type >
box2 ork::box2< type >::enlarge ( const box2< type > &  r  )  const [inline]

Returns the bounding box containing this box and the given box.

Parameters:
r an arbitrary bounding box.
template<typename type >
box2 ork::box2< type >::enlarge ( const vec2< type > &  p  )  const [inline]

Returns the bounding box containing this box and the given point.

Parameters:
p an arbitrary point.
template<typename type >
box2 ork::box2< type >::enlarge ( type  w  )  const [inline]

Returns the bounding box containing this box and the given border.

Parameters:
w the border to be added to this box.
template<typename type >
type ork::box2< type >::height (  )  const [inline]

Returns the height of this bounding box.

template<typename type >
bool ork::box2< type >::intersects ( const box2< type > &  a  )  const [inline]

Alias for clipRectangle.

template<typename type >
vec2<type> ork::box2< type >::nearestInnerPoint ( vec2< type >  a  )  const [inline]

Returns the nearest point to a contained in the box.

template<typename type >
bool ork::box2< type >::operator!= ( const box2< type > &  b  )  const [inline]

Returns true if this box is different from the given box.

template<typename type >
bool ork::box2< type >::operator== ( const box2< type > &  b  )  const [inline]

Returns true if this box is equal to the given box.

template<typename type >
float ork::box2< type >::squaredDistanceTo ( vec2< type >  a  )  const [inline]

Returns the squared minimum distance between the box and a point.

Parameters:
a the point
template<typename type >
type ork::box2< type >::width (  )  const [inline]

Returns the width of this bounding box.


Member Data Documentation

template<typename type >
type ork::box2< type >::xmax

Maximum x coordinate.

template<typename type >
type ork::box2< type >::xmin

Minimum x coordinate.

template<typename type >
type ork::box2< type >::ymax

Maximum y coordinate.

template<typename type >
type ork::box2< type >::ymin

Minimum y coordinate.


Generated on Mon Oct 18 09:36:07 2010 for ork by  doxygen 1.6.1