Support Forum       Library Source       SourceForge Page       G3D Web Page     
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
G3D::Box2D Class Reference

2D oriented box More...

Public Member Functions

 Box2D (const Vector2 &center=Vector2(0, 0), float w=0, float h=0, float angle=0)
 
 Box2D (const AABox2D &b)
 
 Box2D (const Vector2 &min, const Vector2 &max)
 
 Box2D (const CFrame &frame, Box2D &b)
 Transform b by frame, discarding the Z components, and compute the new box.
 
float area () const
 Surface area.
 
const Vector2axis (int a) const
 Unit length vector along axis a.
 
const Vector2center () const
 
bool contains (const Vector2 &v) const
 
const Vector2corner (int i) const
 
const Vector2extent () const
 Distance from corner(0) to the next corner along the box's local axis a.
 
bool overlaps (const Box2D &other) const
 Returns true if the intersection of the boxes is non-empty.
 

Detailed Description

2D oriented box

Referenced Code:
http://www.flipcode.com/archives/2D_OBB_Intersection.shtml

Constructor & Destructor Documentation

G3D::Box2D::Box2D ( const Vector2 center = Vector2(0, 0),
float  w = 0,
float  h = 0,
float  angle = 0 
)
Parameters
centerWorld-space center
wWidth along object-space x-axis
hHeight along object-space y-axis
angleCounter-clockwise angle from object-space x-axis in radians
G3D::Box2D::Box2D ( const AABox2D b)
G3D::Box2D::Box2D ( const Vector2 min,
const Vector2 max 
)
G3D::Box2D::Box2D ( const CFrame frame,
Box2D b 
)

Transform b by frame, discarding the Z components, and compute the new box.

Member Function Documentation

float G3D::Box2D::area ( ) const
inline

Surface area.

const Vector2& G3D::Box2D::axis ( int  a) const
inline

Unit length vector along axis a.

const Vector2& G3D::Box2D::center ( ) const
inline
bool G3D::Box2D::contains ( const Vector2 v) const
inline
const Vector2& G3D::Box2D::corner ( int  i) const
inline
const Vector2& G3D::Box2D::extent ( ) const
inline

Distance from corner(0) to the next corner along the box's local axis a.

bool G3D::Box2D::overlaps ( const Box2D other) const
inline

Returns true if the intersection of the boxes is non-empty.


documentation generated on Sat Jan 12 2013 22:49:54 using doxygen 1.8.2