Om  1.0.0
A universal framework for multimedia simulation
Classes | Public Member Functions | List of all members
om::physics::base::ConvexHull Class Reference

A class that represents a convex polyhedron with triangular faces. More...

#include <omPhysicsConvexHull.h>

Classes

class  Triangle
 
class  Vertex
 

Public Member Functions

 ConvexHull ()
 Create an empty convex hull with no triangles or vertices. More...
 
 ConvexHull (const Vector3f *inputVertices, UInt32 numVertices, Float maxError=0.000001f)
 Create a convex hull from the specified array of input vertices. More...
 
UInt32 getTriangleCount () const
 Return the number of triangles that define the surface of this convex hull. More...
 
const TrianglegetTriangle (UInt32 index) const
 Return a const reference to the convex hull triangle at the specified index. More...
 
StaticArray< UInt32, 3 > getTriangleNeighbors (UInt32 index) const
 Return an array of the three triangle neighbor indices for the triangle at the specified index. More...
 
UInt32 getVertexCount () const
 Return the number of vertices that are on the surface of this convex hull. More...
 
const VertexgetVertex (UInt32 index) const
 Return a reference to the vertex on this convex hull at the specified index. More...
 
void addVertices (const Vector3f *vertices, UInt32 numVertices, Float maxError=0.000001f)
 Add an array of new vertices to the convex hull and update the hull's boundary representation. More...
 
void clearVertices ()
 Remove all of the vertices and triangles from this convex hull. More...
 
Size getVertexTriangleCount (UInt32 vertexIndex) const
 Return the number of triangles which share the specified vertex. More...
 
const TrianglegetVertexTriangle (UInt32 vertexIndex, UInt32 triangleIndex) const
 Return a const reference to the triange sharing the specified vertex at the given index. More...
 
UInt32 getSupportVertexIndex (const SIMDFloat4 &direction, UInt32 startingVertex=0) const
 Determine which vertex on this convex hull is farthest in the specified direction. More...
 
SIMDFloat4 getSupportVertex (const SIMDFloat4 &direction, UInt32 startingVertex=0) const
 Determine which vertex on this convex hull is farthest in the specified direction. More...
 
const AABB3f & getBoundingBox () const
 Return the bounding box of this convex hull. More...
 

Detailed Description

A class that represents a convex polyhedron with triangular faces.

Constructor & Destructor Documentation

om::physics::base::ConvexHull::ConvexHull ( )

Create an empty convex hull with no triangles or vertices.

om::physics::base::ConvexHull::ConvexHull ( const Vector3f *  inputVertices,
UInt32  numVertices,
Float  maxError = 0.000001f 
)

Create a convex hull from the specified array of input vertices.

Member Function Documentation

UInt32 om::physics::base::ConvexHull::getTriangleCount ( ) const
inline

Return the number of triangles that define the surface of this convex hull.

const Triangle& om::physics::base::ConvexHull::getTriangle ( UInt32  index) const
inline

Return a const reference to the convex hull triangle at the specified index.

StaticArray<UInt32,3> om::physics::base::ConvexHull::getTriangleNeighbors ( UInt32  index) const

Return an array of the three triangle neighbor indices for the triangle at the specified index.

UInt32 om::physics::base::ConvexHull::getVertexCount ( ) const
inline

Return the number of vertices that are on the surface of this convex hull.

const Vertex& om::physics::base::ConvexHull::getVertex ( UInt32  index) const
inline

Return a reference to the vertex on this convex hull at the specified index.

void om::physics::base::ConvexHull::addVertices ( const Vector3f *  vertices,
UInt32  numVertices,
Float  maxError = 0.000001f 
)

Add an array of new vertices to the convex hull and update the hull's boundary representation.

void om::physics::base::ConvexHull::clearVertices ( )

Remove all of the vertices and triangles from this convex hull.

Size om::physics::base::ConvexHull::getVertexTriangleCount ( UInt32  vertexIndex) const
inline

Return the number of triangles which share the specified vertex.

const ConvexHull::Triangle & om::physics::base::ConvexHull::getVertexTriangle ( UInt32  vertexIndex,
UInt32  triangleIndex 
) const
inline

Return a const reference to the triange sharing the specified vertex at the given index.

UInt32 om::physics::base::ConvexHull::getSupportVertexIndex ( const SIMDFloat4 &  direction,
UInt32  startingVertex = 0 
) const

Determine which vertex on this convex hull is farthest in the specified direction.

This method uses the optional starting vertex as a best-guess for the supporting vertex. The hull then uses a 'hill-climbing' algorithm to find the actual supporting vertex in the specified direction. The direction does not need to be normalized. The index of the support vertex is returned.

If the convex hull has no vertices, math::max<Index>() is returned.

SIMDFloat4 om::physics::base::ConvexHull::getSupportVertex ( const SIMDFloat4 &  direction,
UInt32  startingVertex = 0 
) const
inline

Determine which vertex on this convex hull is farthest in the specified direction.

This method uses the optional starting vertex as a best-guess for the supporting vertex. The hull then uses a 'hill-climbing' algorithm to find the actual supporting vertex in the specified direction. The direction does not need to be normalized. The position of the support vertex is returned.

If the convex hull has no vertices, the origin is returned.

const AABB3f& om::physics::base::ConvexHull::getBoundingBox ( ) const
inline

Return the bounding box of this convex hull.


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