TriangleExtractor Class Reference
[libipsa classes]

Defines a class which takes an an Inventor model and extracts triangles for use in ODE. More...

#include <TriangleExtractor.h>

Collaboration diagram for TriangleExtractor:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void execute (const SbVec3f &transvec=SbVec3f(0.0f, 0.0f, 0.0f))
VertexStorage< odeVertexType > * getResult ()
 TriangleExtractor (SoNode *object=NULL)
 ~TriangleExtractor ()

Static Private Member Functions

static void TriangleCB (void *data, SoCallbackAction *action, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2, const SoPrimitiveVertex *v3)

Private Attributes

SoNode * ivModel
TriangleCallbackResultresult


Detailed Description

Defines a class which takes an an Inventor model and extracts triangles for use in ODE.

This TriangleExtractor is used to extract all triangles from a given Inventor model.

Definition at line 59 of file TriangleExtractor.h.


Constructor & Destructor Documentation

TriangleExtractor::TriangleExtractor ( SoNode *  object = NULL  ) 

The constructor of TriangleExtractor. It sets the ivModel and creates a TriangleCallbackResult object.

Parameters:
object iv model to extract triangles from (stored in TriangleExtractor::ivModel)

Definition at line 72 of file TriangleExtractor.cpp.

References ivModel, and result.

TriangleExtractor::~TriangleExtractor (  ) 

The destructor of the TriangleExtractor. It deletes the result object.

Definition at line 82 of file TriangleExtractor.cpp.

References result.


Member Function Documentation

void TriangleExtractor::execute ( const SbVec3f &  transvec = SbVec3f(0.0f, 0.0f, 0.0f)  ) 

This method transforms the TriangleExtractor::ivModel by the values from parameter transvec and creates an SoComplexity node to reduce the polygon count of the given Inventor model. Afterwards it creates an SoCallbackAction with the given triangle callback and TriangleExtractor::result to extract the triangles from the model. Only the nodes of the type SoShape get visited.

Parameters:
transvec vector used to translate TriangleExtractor::ivModel before triangle extraction

Definition at line 98 of file TriangleExtractor.cpp.

References ivModel, result, and TriangleCB().

Referenced by SoCollisionShapeTriMesh::cGeom().

VertexStorage< odeVertexType > * TriangleExtractor::getResult (  ) 

This method transforms the result of TriangleExtractor::execute() into the desired format.

Returns:
object of type VertexStorage<odeVertexType*> which contains all vertices and indices of TriangleExtractor::ivModel

Definition at line 124 of file TriangleExtractor.cpp.

References VertexStorage< T >::appendVertex(), VertexStorage< T >::appendVertexIndices(), TriangleCallbackResult::coord3, TriangleCallbackResult::coord3idx, TriangleCallbackResult::ifs, and result.

Referenced by SoCollisionShapeTriMesh::cGeom().

void TriangleExtractor::TriangleCB ( void *  data,
SoCallbackAction *  action,
const SoPrimitiveVertex *  v1,
const SoPrimitiveVertex *  v2,
const SoPrimitiveVertex *  v3 
) [static, private]

The triangle callback is used by an SoCallbackAction to extract the triangles from the given Inventor model. Degenerated vertices are skipped.

Parameters:
data the passed in TriangleExtractor::result object to store the extracted vertex in
action used to get the current model matrix
v1 first point of the vertex
v2 second point of the vertex
v3 third point of the vertex

Definition at line 167 of file TriangleExtractor.cpp.

References TriangleCallbackResult::coord3, TriangleCallbackResult::coord3idx, and TriangleCallbackResult::ifs.

Referenced by execute().


Member Data Documentation

This SoNode is a pointer to the Inventor model whose triangles are to be extracted.

Definition at line 66 of file TriangleExtractor.h.

Referenced by execute(), and TriangleExtractor().

The result object is used as the data pointer for the triangle callback. The resulting vertex set and indexed face set are stored in it.

Definition at line 67 of file TriangleExtractor.h.

Referenced by execute(), getResult(), TriangleExtractor(), and ~TriangleExtractor().


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

Get IPSA - Inventor Physics Simulation API at SourceForge.net. Fast, secure and Free Open Source software downloads
Generated on Sat Mar 10 20:00:21 2012 for IPSA by  doxygen 1.5.8