Support Forum       G3D Web Page     
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. More...
 
float area () const
 Surface area. More...
 
const Vector2axis (int a) const
 Unit length vector along axis a. More...
 
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. More...
 
bool overlaps (const Box2D &other) const
 Returns true if the intersection of the boxes is non-empty. More...
 

Detailed Description

2D oriented box

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

Constructor & Destructor Documentation

◆ Box2D() [1/4]

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

◆ Box2D() [2/4]

G3D::Box2D::Box2D ( const AABox2D b)

◆ Box2D() [3/4]

G3D::Box2D::Box2D ( const Vector2 min,
const Vector2 max 
)

◆ Box2D() [4/4]

G3D::Box2D::Box2D ( const CFrame frame,
Box2D b 
)

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

Member Function Documentation

◆ area()

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

Surface area.

◆ axis()

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

Unit length vector along axis a.

◆ center()

const Vector2& G3D::Box2D::center ( ) const
inline

◆ contains()

bool G3D::Box2D::contains ( const Vector2 v) const
inline

◆ corner()

const Vector2& G3D::Box2D::corner ( int  i) const
inline

◆ extent()

const Vector2& G3D::Box2D::extent ( ) const
inline

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

◆ overlaps()

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

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


documentation generated on Wed Nov 24 2021 08:01:53 using doxygen 1.8.15