CrystalSpace

Public API Reference

csOBB Class Reference
[Geometry utilities]

Oriented bounding box (OBB). More...

#include <csgeom/obb.h>

Inheritance diagram for csOBB:

Inheritance graph
[legend]
List of all members.

Public Member Functions

void AddBoundingVertex (const csVector3 &v)
 Add a new vertex and recalculate the bounding box.
 csOBB (const csVector3 &dir1, const csVector3 &dir2, const csVector3 &dir3)
 Construct an OBB from the three given vectors.
 csOBB (const csBox3 &b)
 Initialize the OBB to the given AABB with identity transform.
 csOBB (const csOBB &b)
 Copy constructor.
 csOBB ()
 Initialize the OBB to empty with identity transform.
float Diameter ()
 Get the diameter of this OBB.
void FindOBB (const csVector3 *vertex_table, int num, float eps=0.0)
 Given the table of vertices find a csOBB that matches this table.
void FindOBBAccurate (const csVector3 *vertex_table, int num)
 Given the table of vertices find a csOBB that matches this table.
csVector3 GetCorner (int corner) const
 Return every corner of this bounding box from 0 to 7.
csMatrix3GetMatrix ()
 Get the rotation matrix for the OBB.
const csMatrix3GetMatrix () const
 Get the rotation matrix for the OBB.
float Volume ()
 Get the volume of this OBB.

Detailed Description

Oriented bounding box (OBB).

This is basically a csBox3 with a matrix to rotate it.

Definition at line 42 of file obb.h.


Constructor & Destructor Documentation

csOBB::csOBB (  )  [inline]

Initialize the OBB to empty with identity transform.

Definition at line 51 of file obb.h.

csOBB::csOBB ( const csOBB b  )  [inline]

Copy constructor.

Definition at line 56 of file obb.h.

csOBB::csOBB ( const csBox3 b  )  [inline]

Initialize the OBB to the given AABB with identity transform.

Definition at line 61 of file obb.h.

csOBB::csOBB ( const csVector3 dir1,
const csVector3 dir2,
const csVector3 dir3 
)

Construct an OBB from the three given vectors.

This will setup the orientation. dir1 are the two vertices furthest appart. dir2 is the two vertices after moving them to the plane perpendicular to dir1 and dir3 is the cross of dir1 and dir2.


Member Function Documentation

void csOBB::AddBoundingVertex ( const csVector3 v  ) 

Add a new vertex and recalculate the bounding box.

Reimplemented from csBox3.

float csOBB::Diameter (  ) 

Get the diameter of this OBB.

void csOBB::FindOBB ( const csVector3 vertex_table,
int  num,
float  eps = 0.0 
)

Given the table of vertices find a csOBB that matches this table.

This is a faster version that FindOBBAccurate() but it is less accurate.

void csOBB::FindOBBAccurate ( const csVector3 vertex_table,
int  num 
)

Given the table of vertices find a csOBB that matches this table.

This version is a lot slower than FindOBB but it gives a more accurate OBB.

csVector3 csOBB::GetCorner ( int  corner  )  const

Return every corner of this bounding box from 0 to 7.

This contrasts with Min() and Max() because those are only the min and max corners. Corner 0 = xyz, 1 = xyZ, 2 = xYz, 3 = xYZ, 4 = Xyz, 5 = XyZ, 6 = XYz, 7 = XYZ. Use CS_BOX_CORNER_xyz etc. defines. CS_BOX_CENTER3 also works.

Reimplemented from csBox3.

Referenced by csOBBFrozen::Copy().

csMatrix3& csOBB::GetMatrix (  )  [inline]

Get the rotation matrix for the OBB.

Definition at line 85 of file obb.h.

const csMatrix3& csOBB::GetMatrix (  )  const [inline]

Get the rotation matrix for the OBB.

Definition at line 79 of file obb.h.

float csOBB::Volume (  ) 

Get the volume of this OBB.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.4.7