AGX Dynamics 2.41.1.2
Loading...
Searching...
No Matches
agxUtil::ConvexReaderWriter Namespace Reference

Functions for generating Convex shapes from meshes, and for serializing them. More...

Functions

AGXPHYSICS_EXPORT agxCollide::ConvexcreateConvex (const agx::String &filename, const agx::Matrix3x3 &transformation=agx::Matrix3x3(), const agx::Vec3 &translation=agx::Vec3())
 Creates a convex shape from a trimesh file.
 
AGXPHYSICS_EXPORT agxCollide::ConvexcreateConvex (const agx::Vec3Vector &vertices, const agx::Matrix3x3 &transformation=agx::Matrix3x3(), const agx::Vec3 &translation=agx::Vec3())
 Creates a convex shape from vertices only, building their convex hull.
 
AGXPHYSICS_EXPORT bool createConvexDecomposition (const agx::String &filename, agxCollide::ConvexRefVector &results, size_t elementResolutionPerAxis=50, const agx::Matrix3x3 &transformation=agx::Matrix3x3(), const agx::Vec3 &translation=agx::Vec3())
 Creates a set of convex shapes that approximates the triangle mesh defined by filename using V-HACD which uses a volumetric algorithm.
 
AGXPHYSICS_EXPORT bool createConvexDecomposition (const agx::Vec3Vector &vertices, const agx::UInt32Vector &indices, agxCollide::ConvexRefVector &results, size_t elementResolutionPerAxis=50, const agx::Matrix3x3 &transformation=agx::Matrix3x3(), const agx::Vec3 &translation=agx::Vec3())
 Creates a set of convex shapes that approximates the triangle mesh defined by filename using V-HACD which uses a volumetric algorithm.
 
AGXPHYSICS_EXPORT agxCollide::ConvexcreateFromConvex (const agx::String &filename, const agx::Matrix3x3 &transformation=agx::Matrix3x3(), const agx::Vec3 &translation=agx::Vec3())
 Creates a convex from a supported mesh-file (see agxIO::MeshReader::FileType) which is known to be convex.
 
AGXPHYSICS_EXPORT agxCollide::ConvexcreateFromConvex (const agx::Vec3Vector &vertices, const agx::UInt32Vector &indices, const agx::String &sourceName="convexFromReaderWriter", const agx::Matrix3x3 &transformation=agx::Matrix3x3(), const agx::Vec3 &translation=agx::Vec3())
 Creates a convex from vertices which are known to be convex.
 
AGXPHYSICS_EXPORT bool createVHACDConvexDecomposition (const agx::String &filename, agxCollide::ConvexRefVector &results, size_t elementResolutionPerAxis=50, const agx::Matrix3x3 &transformation=agx::Matrix3x3(), const agx::Vec3 &translation=agx::Vec3())
 Creates a set of convex shapes that approximates the triangle mesh defined by filename using V-HACD which uses a volumetric algorithm.
 
AGXPHYSICS_EXPORT bool createVHACDConvexDecomposition (const agx::Vec3Vector &vertices, const agx::UInt32Vector &indices, agxCollide::ConvexRefVector &results, size_t elementResolutionPerAxis=50, const agx::Matrix3x3 &transformation=agx::Matrix3x3(), const agx::Vec3 &translation=agx::Vec3())
 Creates a set of convex shapes that approximates the triangle mesh defined by vertices and indices using V-HACD which uses a volumetric algorithm.
 
AGXPHYSICS_EXPORT bool exportConvex (const agxCollide::Convex &convex, const agx::String &filename)
 Exports convex vertex and index data to a wavefront obj file on a storage device.
 

Detailed Description

Functions for generating Convex shapes from meshes, and for serializing them.

Function Documentation

◆ createConvex() [1/2]

AGXPHYSICS_EXPORT agxCollide::Convex * agxUtil::ConvexReaderWriter::createConvex ( const agx::String filename,
const agx::Matrix3x3 transformation = agx::Matrix3x3(),
const agx::Vec3 translation = agx::Vec3() 
)

Creates a convex shape from a trimesh file.

The mesh in the file can be concave, the create convex will encapsulate the whole triangle mesh into the hull.

Parameters
filename- The Mesh filename
transformationScaling and rotation of each vertex.
translationTranslation of each vertex (executed after transformation).
Returns
The created Convex. Might be 0 if an error occurred.

◆ createConvex() [2/2]

AGXPHYSICS_EXPORT agxCollide::Convex * agxUtil::ConvexReaderWriter::createConvex ( const agx::Vec3Vector vertices,
const agx::Matrix3x3 transformation = agx::Matrix3x3(),
const agx::Vec3 translation = agx::Vec3() 
)

Creates a convex shape from vertices only, building their convex hull.

Vertices lying within the convex hull will be ignored.

Note
The algorithm is using float precision. Using vertices with large coordinate values might result in an inexact convex hull.
Parameters
verticesThe vertices.
transformationScaling and rotation of each vertex.
translationTranslation of each vertex (executed after transformation).
Returns
The created Convex. Might be 0 if an error occurred.

◆ createConvexDecomposition() [1/2]

AGXPHYSICS_EXPORT bool agxUtil::ConvexReaderWriter::createConvexDecomposition ( const agx::String filename,
agxCollide::ConvexRefVector results,
size_t  elementResolutionPerAxis = 50,
const agx::Matrix3x3 transformation = agx::Matrix3x3(),
const agx::Vec3 translation = agx::Vec3() 
)

Creates a set of convex shapes that approximates the triangle mesh defined by filename using V-HACD which uses a volumetric algorithm.

The computation time can be high, if a large voxel resolution is used.

Parameters
filenameName of mesh file.
resultsThe result vector.
elementResolutionPerAxisResolution parameter. Range 20-400. Larger values take more time.
transformationScaling and rotation of each vertex.
translationTranslation of each vertex (executed after transformation).
Returns
True if convex decomposition was successful and generated output

◆ createConvexDecomposition() [2/2]

AGXPHYSICS_EXPORT bool agxUtil::ConvexReaderWriter::createConvexDecomposition ( const agx::Vec3Vector vertices,
const agx::UInt32Vector indices,
agxCollide::ConvexRefVector results,
size_t  elementResolutionPerAxis = 50,
const agx::Matrix3x3 transformation = agx::Matrix3x3(),
const agx::Vec3 translation = agx::Vec3() 
)

Creates a set of convex shapes that approximates the triangle mesh defined by filename using V-HACD which uses a volumetric algorithm.

The computation time can be high, if a large voxel resolution is used.

Parameters
verticesThe vertices.
indicesThe indices.
resultsThe result vector.
elementResolutionPerAxisResolution parameter. Range 20-400. Larger values take more time.
transformationScaling and rotation of each vertex.
translationTranslation of each vertex (executed after transformation).
Returns
True if convex decomposition was successful and generated output

◆ createFromConvex() [1/2]

AGXPHYSICS_EXPORT agxCollide::Convex * agxUtil::ConvexReaderWriter::createFromConvex ( const agx::String filename,
const agx::Matrix3x3 transformation = agx::Matrix3x3(),
const agx::Vec3 translation = agx::Vec3() 
)

Creates a convex from a supported mesh-file (see agxIO::MeshReader::FileType) which is known to be convex.

Note
No convex decomposition will be done, also no Convex generation will be done if the mesh is not convex
See also
createConvex
Parameters
filenameThe file name.
transformationScaling and rotation of each vertex.
translationTranslation of each vertex (executed after transformation).
Returns
The convex.

◆ createFromConvex() [2/2]

AGXPHYSICS_EXPORT agxCollide::Convex * agxUtil::ConvexReaderWriter::createFromConvex ( const agx::Vec3Vector vertices,
const agx::UInt32Vector indices,
const agx::String sourceName = "convexFromReaderWriter",
const agx::Matrix3x3 transformation = agx::Matrix3x3(),
const agx::Vec3 translation = agx::Vec3() 
)

Creates a convex from vertices which are known to be convex.

Note
No convex decomposition will be done.
Parameters
verticesThe triangle mesh vertices.
indicesThe triangle mesh indices.
sourceNameThe name of the data source.
transformationScaling and rotation of each vertex.
translationTranslation of each vertex (executed after transformation).
Return values
Theconvex.

◆ createVHACDConvexDecomposition() [1/2]

AGXPHYSICS_EXPORT bool agxUtil::ConvexReaderWriter::createVHACDConvexDecomposition ( const agx::String filename,
agxCollide::ConvexRefVector results,
size_t  elementResolutionPerAxis = 50,
const agx::Matrix3x3 transformation = agx::Matrix3x3(),
const agx::Vec3 translation = agx::Vec3() 
)

Creates a set of convex shapes that approximates the triangle mesh defined by filename using V-HACD which uses a volumetric algorithm.

The computation time can be high, if a large voxel resolution is used.

Parameters
filenameName of mesh file.
resultsThe result vector.
elementResolutionPerAxisResolution parameter. Will be clamped between 20-400. Larger values take more time.
transformationScaling and rotation of each vertex.
translationTranslation of each vertex (executed after transformation).
Returns
True if convex decomposition was successful and generated output

◆ createVHACDConvexDecomposition() [2/2]

AGXPHYSICS_EXPORT bool agxUtil::ConvexReaderWriter::createVHACDConvexDecomposition ( const agx::Vec3Vector vertices,
const agx::UInt32Vector indices,
agxCollide::ConvexRefVector results,
size_t  elementResolutionPerAxis = 50,
const agx::Matrix3x3 transformation = agx::Matrix3x3(),
const agx::Vec3 translation = agx::Vec3() 
)

Creates a set of convex shapes that approximates the triangle mesh defined by vertices and indices using V-HACD which uses a volumetric algorithm.

The computation time can be high, if a large voxel resolution is used.

Parameters
verticesThe triangle mesh vertices.
indicesThe triangle mesh indices.
resultsThe generated convex meshes.
elementResolutionPerAxisResolution parameter. Range 20-400. Larger values take more time.
transformationScaling and rotation of each vertex.
translationTranslation of each vertex (executed after transformation).
Returns
True if convex decomposition was successful and generated output

◆ exportConvex()

AGXPHYSICS_EXPORT bool agxUtil::ConvexReaderWriter::exportConvex ( const agxCollide::Convex convex,
const agx::String filename 
)

Exports convex vertex and index data to a wavefront obj file on a storage device.

This can be useful when creating convex meshes from other sources than 3D data files.

Parameters
convexThe convex to serialize.
filenameThe desired file name (one would probably want it to end on .obj)
Returns
Was the write operation successful?