AI_BBox Class Reference
[Mathematics]

#include <AI_BBox.h>

List of all members.


Detailed Description

(non-oriented) bounding box

Public Types

enum  {
  ClipLeft = (1<<0),
  ClipRight = (1<<1),
  ClipBottom = (1<<2),
  ClipTop = (1<<3),
  ClipNear = (1<<4),
  ClipFar = (1<<5)
}
 clip codes More...
enum  ClipStatus {
  Outside,
  Inside,
  Clipped
}
 clip status More...
enum  {
  OUTSIDE = 0,
  ISEQUAL = (1<<0),
  ISCONTAINED = (1<<1),
  CONTAINS = (1<<2),
  CLIPS = (1<<3)
}

Public Member Functions

 AI_BBox ()
 constructor 1
 AI_BBox (const AI_Vector3 &center, const AI_Vector3 &extents)
 constructor 3
 AI_BBox (const AI_Matrix44 &m)
 construct bounding box from AI_Matrix44
AI_Vector3 center () const
 get center point
AI_Vector3 extents () const
 get extents of box
AI_Vector3 size () const
 get size of box
float diagonal_size () const
 get diagonal size of box
void set (const AI_Matrix44 &m)
 set from AI_Matrix44
void set (const AI_Vector3 &center, const AI_Vector3 &extents)
 set from center point and extents
void begin_extend ()
 begin extending the box
void extend (const AI_Vector3 &v)
 extend the box
void extend (float x, float y, float z)
 extend the box
void extend (const AI_BBox &box)
 extend the box
void transform (const AI_Matrix44 &m)
 transform axis aligned bounding box
bool intersects (const AI_BBox &box) const
 check for intersection with axis aligned bounding box
bool contains (const AI_BBox &box) const
 check if this box completely contains the parameter box
bool contains (const AI_Vector3 &pos) const
 return true if this box contains the position
ClipStatus clipstatus (const AI_BBox &other) const
 check for intersection with other bounding box
ClipStatus clipstatus (const AI_Matrix44 &viewProjection) const
 check for intersection with projection volume
AI_Matrix44 to_matrix44 () const
 create a matrix which transforms a unit cube to this bounding box
int line_test (float v0, float v1, float w0, float w1)
int intersect (AI_BBox box)
bool intersect (const AI_Line3 &line, AI_Vector3 &ipos) const
 Gets closest intersection with AABB. If the line starts inside the box, start point is returned in ipos.
bool isect_const_x (const float x, const AI_Line3 &l, AI_Vector3 &out) const
bool isect_const_y (const float y, const AI_Line3 &l, AI_Vector3 &out) const
bool isect_const_z (const float z, const AI_Line3 &l, AI_Vector3 &out) const
bool pip_const_x (const AI_Vector3 &p) const
bool pip_const_y (const AI_Vector3 &p) const
bool pip_const_z (const AI_Vector3 &p) const

Public Attributes

AI_Vector3 vmin
AI_Vector3 vmax

Member Enumeration Documentation

anonymous enum

clip codes

Enumerator:
ClipLeft 
ClipRight 
ClipBottom 
ClipTop 
ClipNear 
ClipFar 

clip status

Enumerator:
Outside 
Inside 
Clipped 

anonymous enum

Enumerator:
OUTSIDE 
ISEQUAL 
ISCONTAINED 
CONTAINS 
CLIPS 


Constructor & Destructor Documentation

AI_BBox::AI_BBox (  )  [inline]

constructor 1

AI_BBox::AI_BBox ( const AI_Vector3 center,
const AI_Vector3 extents 
) [inline]

constructor 3

AI_BBox::AI_BBox ( const AI_Matrix44 m  )  [inline]

construct bounding box from AI_Matrix44


Member Function Documentation

AI_Vector3 AI_BBox::center (  )  const [inline]

get center point

AI_Vector3 AI_BBox::extents (  )  const [inline]

get extents of box

AI_Vector3 AI_BBox::size (  )  const [inline]

get size of box

float AI_BBox::diagonal_size (  )  const [inline]

get diagonal size of box

void AI_BBox::set ( const AI_Matrix44 m  )  [inline]

set from AI_Matrix44

Construct a bounding box around a 4x4 matrix. The translational part defines the center point, and the x,y,z vectors of the matrix define the extents.

void AI_BBox::set ( const AI_Vector3 center,
const AI_Vector3 extents 
) [inline]

set from center point and extents

void AI_BBox::begin_extend (  )  [inline]

begin extending the box

void AI_BBox::extend ( const AI_Vector3 v  )  [inline]

extend the box

void AI_BBox::extend ( float  x,
float  y,
float  z 
) [inline]

extend the box

void AI_BBox::extend ( const AI_BBox box  )  [inline]

extend the box

void AI_BBox::transform ( const AI_Matrix44 m  )  [inline]

transform axis aligned bounding box

Transforms this axis aligned bounding by the 4x4 matrix. This bounding box must be axis aligned with the matrix, the resulting bounding will be axis aligned in the matrix' "destination" space.

E.g. if you have a bounding box in model space 'modelBox', and a 'modelView' matrix, the operation

modelBox.transform(modelView)

would transform the bounding box into view space.

bool AI_BBox::intersects ( const AI_BBox box  )  const [inline]

check for intersection with axis aligned bounding box

Check for intersection of 2 axis aligned bounding boxes. The bounding boxes must live in the same coordinate space.

bool AI_BBox::contains ( const AI_BBox box  )  const [inline]

check if this box completely contains the parameter box

Check if the parameter bounding box is completely contained in this bounding box.

bool AI_BBox::contains ( const AI_Vector3 v  )  const [inline]

return true if this box contains the position

Check if position is inside bounding box.

AI_BBox::ClipStatus AI_BBox::clipstatus ( const AI_BBox other  )  const [inline]

check for intersection with other bounding box

Return box/box clip status.

AI_BBox::ClipStatus AI_BBox::clipstatus ( const AI_Matrix44 viewProjection  )  const [inline]

check for intersection with projection volume

Check for intersection with a view volume defined by a view-projection matrix.

AI_Matrix44 AI_BBox::to_matrix44 (  )  const [inline]

create a matrix which transforms a unit cube to this bounding box

Create a transform matrix which would transform a unit cube to this bounding box.

int AI_BBox::line_test ( float  v0,
float  v1,
float  w0,
float  w1 
) [inline]

check if box intersects, contains or is contained in other box by doing 3 projection tests for each dimension, if all 3 test return true, then the 2 boxes intersect

int AI_BBox::intersect ( AI_BBox  box  )  [inline]

bool AI_BBox::intersect ( const AI_Line3 line,
AI_Vector3 ipos 
) const [inline]

Gets closest intersection with AABB. If the line starts inside the box, start point is returned in ipos.

Gets closest intersection with AABB. If the line starts inside the box, start point is returned in ipos.

Parameters:
line the pick ray
ipos closest point of intersection if successful, trash otherwise
Returns:
true if an intersection occurs
Parameters:
line the pick ray
ipos closest point of intersection if successful, trash otherwise
Returns:
true if an intersection occurs

bool AI_BBox::isect_const_x ( const float  x,
const AI_Line3 l,
AI_Vector3 out 
) const [inline]

bool AI_BBox::isect_const_y ( const float  y,
const AI_Line3 l,
AI_Vector3 out 
) const [inline]

bool AI_BBox::isect_const_z ( const float  z,
const AI_Line3 l,
AI_Vector3 out 
) const [inline]

bool AI_BBox::pip_const_x ( const AI_Vector3 p  )  const [inline]

bool AI_BBox::pip_const_y ( const AI_Vector3 p  )  const [inline]

bool AI_BBox::pip_const_z ( const AI_Vector3 p  )  const [inline]


Member Data Documentation


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