CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

csOBB Class Reference
[Geometry utilities]

Oriented bounding box (OBB). More...

#include <obb.h>

Inheritance diagram for csOBB:

csBox3 List of all members.

Public Methods

 csOBB ()
 Initialize the OBB to empty with identity transform. More...

 csOBB (const csOBB &b)
 Copy constructor. More...

 csOBB (const csBox3 &b)
 Initialize the OBB to the given AABB with identity transform. More...

 csOBB (const csVector3 &dir1, const csVector3 &dir2, const csVector3 &dir3)
 Construct an OBB from the three given vectors. More...

void AddBoundingVertex (const csVector3 &v)
 Add a new vertex and recalculate the bounding box. More...

csVector3 GetCorner (int corner) const
 Return every corner of this bounding box from 0 to 7. More...

float Diameter ()
 Get the diameter of this OBB. More...

float Volume ()
 Get the volume of this OBB. More...

void FindOBB (const csVector3 *vertex_table, int num, float eps=0.0)
 Given the table of vertices find a csOBB that matches this table. More...

void FindOBBAccurate (const csVector3 *vertex_table, int num)
 Given the table of vertices find a csOBB that matches this table. More...


Detailed Description

Oriented bounding box (OBB).

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

Definition at line 39 of file obb.h.


Constructor & Destructor Documentation

csOBB::csOBB   [inline]
 

Initialize the OBB to empty with identity transform.

Definition at line 48 of file obb.h.

csOBB::csOBB const csOBB &    b [inline]
 

Copy constructor.

Definition at line 53 of file obb.h.

csOBB::csOBB const csBox3   b [inline]
 

Initialize the OBB to the given AABB with identity transform.

Definition at line 58 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.

Reimplemented from csBox3.

Referenced by csOBBFrozen::Copy.

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.2.14