Cinder  0.9.1
Public Member Functions | Protected Attributes | List of all members
cinder::AxisAlignedBox Class Reference

#include <AxisAlignedBox.h>

Public Member Functions

 AxisAlignedBox ()
 
 AxisAlignedBox (const vec3 &min, const vec3 &max)
 
const vec3 & getCenter () const
 
const vec3 & getExtents () const
 
vec3 getSize () const
 
vec3 getMin () const
 
vec3 getMax () const
 
void set (const vec3 &min, const vec3 &max)
 
void include (const vec3 &point)
 
void include (const AxisAlignedBox &box)
 
bool contains (const vec3 &point) const
 
bool intersects (const AxisAlignedBox &box) const
 
bool intersects (const ci::Sphere &sphere) const
 
bool intersects (const Ray &ray) const
 
int intersect (const Ray &ray, float *min, float *max) const
 
void project (const vec3 &normal, float *min, float *max) const
 
vec3 getNegative (const vec3 &normal) const
 
vec3 getPositive (const vec3 &normal) const
 
void transform (const mat4 &transform)
 
AxisAlignedBox transformed (const mat4 &transform) const
 

Protected Attributes

vec3 mCenter
 
vec3 mExtents
 

Constructor & Destructor Documentation

cinder::AxisAlignedBox::AxisAlignedBox ( )
cinder::AxisAlignedBox::AxisAlignedBox ( const vec3 &  min,
const vec3 &  max 
)

Member Function Documentation

const vec3& cinder::AxisAlignedBox::getCenter ( ) const

Returns the center of the axis-aligned box.

const vec3& cinder::AxisAlignedBox::getExtents ( ) const

Returns the extents of the axis-aligned box.

vec3 cinder::AxisAlignedBox::getSize ( ) const

Returns the size of the axis-aligned box.

vec3 cinder::AxisAlignedBox::getMin ( ) const

Returns the corner of the axis-aligned box with the smallest x, y and z coordinates.

vec3 cinder::AxisAlignedBox::getMax ( ) const

Returns the corner of the axis-aligned box with the largest x, y and z coordinates.

void cinder::AxisAlignedBox::set ( const vec3 &  min,
const vec3 &  max 
)

Construct an axis-aligned box by specifying two opposite corners.

void cinder::AxisAlignedBox::include ( const vec3 &  point)

Expands the box so that it contains point.

void cinder::AxisAlignedBox::include ( const AxisAlignedBox box)

Expands the box so that it contains box.

bool cinder::AxisAlignedBox::contains ( const vec3 &  point) const

Returns true if the axis-aligned box contains point.

bool cinder::AxisAlignedBox::intersects ( const AxisAlignedBox box) const

Returns true if the axis-aligned boxes intersect.

bool cinder::AxisAlignedBox::intersects ( const ci::Sphere sphere) const

Returns true if the axis-aligned box intersects sphere.

bool cinder::AxisAlignedBox::intersects ( const Ray ray) const

Returns true if the ray intersects the axis-aligned box.

int cinder::AxisAlignedBox::intersect ( const Ray ray,
float *  min,
float *  max 
) const

Performs ray intersections and returns the number of intersections (0, 1 or 2). Returns min and max distance from the ray origin.

void cinder::AxisAlignedBox::project ( const vec3 &  normal,
float *  min,
float *  max 
) const

Given a plane through the origin with normal, returns the minimum and maximum distance to the axis-aligned box.

vec3 cinder::AxisAlignedBox::getNegative ( const vec3 &  normal) const

Given a plane through the origin with normal, returns the corner closest to the plane.

vec3 cinder::AxisAlignedBox::getPositive ( const vec3 &  normal) const

Given a plane through the origin with normal, returns the corner farthest from the plane.

void cinder::AxisAlignedBox::transform ( const mat4 &  transform)

Converts axis-aligned box to another coordinate space.

AxisAlignedBox cinder::AxisAlignedBox::transformed ( const mat4 &  transform) const

Converts axis-aligned box to another coordinate space.

Member Data Documentation

vec3 cinder::AxisAlignedBox::mCenter
protected
vec3 cinder::AxisAlignedBox::mExtents
protected

The documentation for this class was generated from the following file: