RavEngine
Loading...
Searching...
No Matches
physx::PxTetMaker Class Reference

Provides functionality to create a tetrahedral mesh from a triangle mesh. More...

#include <PxTetMakerExt.h>

Static Public Member Functions

static bool createConformingTetrahedronMesh (const PxSimpleTriangleMesh &triangleMesh, physx::PxArray< physx::PxVec3 > &outVertices, physx::PxArray< physx::PxU32 > &outTetIndices, const bool validate=true, PxReal volumeThreshold=0.0f)
 Create conforming tetrahedron mesh using TetMaker.
 
static bool createVoxelTetrahedronMesh (const PxTetrahedronMeshDesc &tetMesh, const PxU32 numVoxelsAlongLongestBoundingBoxAxis, physx::PxArray< physx::PxVec3 > &outVertices, physx::PxArray< physx::PxU32 > &outTetIndices, PxI32 *inputPointToOutputTetIndex=NULL, const PxU32 *anchorNodeIndices=NULL)
 Create voxel-based tetrahedron mesh using TetMaker.
 
static bool createVoxelTetrahedronMeshFromEdgeLength (const PxTetrahedronMeshDesc &tetMesh, const PxReal voxelEdgeLength, physx::PxArray< physx::PxVec3 > &outVertices, physx::PxArray< physx::PxU32 > &outTetIndices, PxI32 *inputPointToOutputTetIndex=NULL, const PxU32 *anchorNodeIndices=NULL)
 Create voxel-based tetrahedron mesh using TetMaker.
 
static PxTriangleMeshAnalysisResults validateTriangleMesh (const PxSimpleTriangleMesh &triangleMesh, const PxReal minVolumeThreshold=1e-6f, const PxReal minTriangleAngleRadians=10.0f *3.1415926535898f/180.0f)
 Analyzes the triangle mesh to get a report about deficiencies. Some deficiencies can be handled by the tetmesher, others cannot.
 
static PxTetrahedronMeshAnalysisResults validateTetrahedronMesh (const PxBoundedData &points, const PxBoundedData &tetrahedra, const PxReal minTetVolumeThreshold=1e-8f)
 Analyzes the tetrahedron mesh to get a report about deficiencies. Some deficiencies can be handled by the softbody cooker, others cannot.
 
static void simplifyTriangleMesh (const PxArray< PxVec3 > &inputVertices, const PxArray< PxU32 > &inputIndices, int targetTriangleCount, PxF32 maximalEdgeLength, PxArray< PxVec3 > &outputVertices, PxArray< PxU32 > &outputIndices, PxArray< PxU32 > *vertexMap=NULL, PxReal edgeLengthCostWeight=0.1f, PxReal flatnessDetectionThreshold=0.01f)
 Simplifies (decimates) a triangle mesh using quadric simplification.
 
static void remeshTriangleMesh (const PxArray< PxVec3 > &inputVertices, const PxArray< PxU32 > &inputIndices, int gridResolution, PxArray< PxVec3 > &outputVertices, PxArray< PxU32 > &outputIndices, PxArray< PxU32 > *vertexMap=NULL)
 Creates a new mesh from a given mesh. The input mesh is first voxelized. The new surface is created from the voxel surface and subsequent projection to the original mesh.
 
static void createTreeBasedTetrahedralMesh (const PxArray< PxVec3 > &inputVertices, const PxArray< PxU32 > &inputIndices, bool useTreeNodes, PxArray< PxVec3 > &outputVertices, PxArray< PxU32 > &outputIndices, PxReal volumeThreshold=0.0f)
 Creates a tetrahedral mesh using an octree.
 
static void createRelaxedVoxelTetrahedralMesh (const PxArray< PxVec3 > &inputVertices, const PxArray< PxU32 > &inputIndices, PxArray< PxVec3 > &outputVertices, PxArray< PxU32 > &outputIndices, PxI32 resolution, PxI32 numRelaxationIterations=5, PxF32 relMinTetVolume=0.05f)
 Creates a tetrahedral mesh by relaxing a voxel mesh around the input mesh.
 

Detailed Description

Provides functionality to create a tetrahedral mesh from a triangle mesh.

Member Function Documentation

◆ createConformingTetrahedronMesh()

bool PxTetMaker::createConformingTetrahedronMesh ( const PxSimpleTriangleMesh &  triangleMesh,
physx::PxArray< physx::PxVec3 > &  outVertices,
physx::PxArray< physx::PxU32 > &  outTetIndices,
const bool  validate = true,
PxReal  volumeThreshold = 0.0f 
)
static

Create conforming tetrahedron mesh using TetMaker.

Parameters
[in]triangleMeshThe description of the triangle mesh including vertices and indices
[out]outVerticesThe vertices to store the conforming tetrahedral mesh
[out]outTetIndicesThe indices to store the conforming tetrahedral mesh
[in]validateIf set to true the input triangle mesh will get analyzed to find possible deficiencies
[in]volumeThresholdTetrahedra with a volume smaller than the specified threshold will be removed from the mesh
Returns
True if success

◆ createRelaxedVoxelTetrahedralMesh()

void PxTetMaker::createRelaxedVoxelTetrahedralMesh ( const PxArray< PxVec3 > &  inputVertices,
const PxArray< PxU32 > &  inputIndices,
PxArray< PxVec3 > &  outputVertices,
PxArray< PxU32 > &  outputIndices,
PxI32  resolution,
PxI32  numRelaxationIterations = 5,
PxF32  relMinTetVolume = 0.05f 
)
static

Creates a tetrahedral mesh by relaxing a voxel mesh around the input mesh.

Parameters
[in]inputVerticesThe vertices of the input triangle mesh
[in]inputIndicesThe indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
[out]outputVerticesThe vertices of the output tetrahedral mesh
[out]outputIndicesThe indices of the output tetrahedral mesh of the form (id0, id1, id2, id3), (id0, id1, id2, id3), ..
[in]resolutionThe grid spacing is computed as the diagonal of the bounding box of the input mesh divided by the resolution.
[in]numRelaxationIterationsNumber of iterations to pull the tetrahedral mesh towards the input mesh
[in]relMinTetVolumeConstrains the volumes of the tetrahedra to stay abobe relMinTetvolume times the tetrahedron's rest volume.

◆ createTreeBasedTetrahedralMesh()

void PxTetMaker::createTreeBasedTetrahedralMesh ( const PxArray< PxVec3 > &  inputVertices,
const PxArray< PxU32 > &  inputIndices,
bool  useTreeNodes,
PxArray< PxVec3 > &  outputVertices,
PxArray< PxU32 > &  outputIndices,
PxReal  volumeThreshold = 0.0f 
)
static

Creates a tetrahedral mesh using an octree.

Parameters
[in]inputVerticesThe vertices of the input triangle mesh
[in]inputIndicesThe indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
[in]useTreeNodesUsing the nodes of the octree as tetrahedral vertices
[out]outputVerticesThe vertices of the output tetrahedral mesh
[out]outputIndicesThe indices of the output tetrahedral mesh of the form (id0, id1, id2, id3), (id0, id1, id2, id3), ..
[in]volumeThresholdTetrahedra with a volume smaller than the specified threshold will be removed from the mesh

◆ createVoxelTetrahedronMesh()

bool PxTetMaker::createVoxelTetrahedronMesh ( const PxTetrahedronMeshDesc &  tetMesh,
const PxU32  numVoxelsAlongLongestBoundingBoxAxis,
physx::PxArray< physx::PxVec3 > &  outVertices,
physx::PxArray< physx::PxU32 > &  outTetIndices,
PxI32 *  inputPointToOutputTetIndex = NULL,
const PxU32 *  anchorNodeIndices = NULL 
)
static

Create voxel-based tetrahedron mesh using TetMaker.

Parameters
[in]tetMeshThe description of the tetrahedral mesh including vertices and indices
[in]numVoxelsAlongLongestBoundingBoxAxisThe number of voxels along the longest bounding box axis
[out]outVerticesThe vertices to store the voxel-based tetrahedral mesh
[out]outTetIndicesThe indices to store the voxel-based tetrahedral mesh
[out]inputPointToOutputTetIndexBuffer with the size of nbTetVerts that contains the tetrahedron index containing the input point with the same index
[in]anchorNodeIndicesSome input vertices may not be referenced by any tetrahedron. They can be mapped to another input vertex that is used by a tetrahedron to support embedding of additional points.
Returns
True if success

◆ createVoxelTetrahedronMeshFromEdgeLength()

bool PxTetMaker::createVoxelTetrahedronMeshFromEdgeLength ( const PxTetrahedronMeshDesc &  tetMesh,
const PxReal  voxelEdgeLength,
physx::PxArray< physx::PxVec3 > &  outVertices,
physx::PxArray< physx::PxU32 > &  outTetIndices,
PxI32 *  inputPointToOutputTetIndex = NULL,
const PxU32 *  anchorNodeIndices = NULL 
)
static

Create voxel-based tetrahedron mesh using TetMaker.

Parameters
[in]tetMeshThe description of the tetrahedral mesh including vertices and indices
[in]voxelEdgeLengthThe edge length of a voxel.Can be adjusted slightly such that a multiple of it matches the input points' bounding box size
[out]outVerticesThe vertices to store the voxel-based tetrahedral mesh
[out]outTetIndicesThe indices to store the voxel-based tetrahedral mesh
[out]inputPointToOutputTetIndexBuffer with the size of nbTetVerts that contains the tetrahedron index containing the input point with the same index
[in]anchorNodeIndicesSome input vertices may not be referenced by any tetrahedron. They can be mapped to another input vertex that is used by a tetrahedron to support embedding of additional points.
Returns
True if success

◆ remeshTriangleMesh()

void PxTetMaker::remeshTriangleMesh ( const PxArray< PxVec3 > &  inputVertices,
const PxArray< PxU32 > &  inputIndices,
int  gridResolution,
PxArray< PxVec3 > &  outputVertices,
PxArray< PxU32 > &  outputIndices,
PxArray< PxU32 > *  vertexMap = NULL 
)
static

Creates a new mesh from a given mesh. The input mesh is first voxelized. The new surface is created from the voxel surface and subsequent projection to the original mesh.

Parameters
[in]inputVerticesThe vertices of the input triangle mesh
[in]inputIndicesThe indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
[in]gridResolutionSize of the voxel grid (number of voxels along the longest dimension)
[out]outputVerticesThe vertices of the output (decimated) triangle mesh
[out]outputIndicesThe indices of the output (decimated) triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
[out]vertexMapOptional parameter which returns a mapping from input to output vertices. Since the meshes are independent, the mapping returns an output vertex that is topologically close to the input vertex.

◆ simplifyTriangleMesh()

void PxTetMaker::simplifyTriangleMesh ( const PxArray< PxVec3 > &  inputVertices,
const PxArray< PxU32 > &  inputIndices,
int  targetTriangleCount,
PxF32  maximalEdgeLength,
PxArray< PxVec3 > &  outputVertices,
PxArray< PxU32 > &  outputIndices,
PxArray< PxU32 > *  vertexMap = NULL,
PxReal  edgeLengthCostWeight = 0.1f,
PxReal  flatnessDetectionThreshold = 0.01f 
)
static

Simplifies (decimates) a triangle mesh using quadric simplification.

Parameters
[in]inputVerticesThe vertices of the input triangle mesh
[in]inputIndicesThe indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
[in]targetTriangleCountDesired number of triangles in the output mesh
[in]maximalEdgeLengthEdges below this length will not be collapsed. A value of zero means there is no limit.
[out]outputVerticesThe vertices of the output (decimated) triangle mesh
[out]outputIndicesThe indices of the output (decimated) triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
[out]vertexMapOptional parameter which returns the mapping from input to output vertices. Note that multiple input vertices are typically collapsed into the same output vertex.
[in]edgeLengthCostWeightFactor to scale influence of edge length when prioritizing edge collapses. Has no effect if set to zero.
[in]flatnessDetectionThresholdThreshold used to detect edges in flat regions and to improve the placement of the collapsed point. If set to a large value it will have no effect.

◆ validateTetrahedronMesh()

PxTetrahedronMeshAnalysisResults PxTetMaker::validateTetrahedronMesh ( const PxBoundedData &  points,
const PxBoundedData &  tetrahedra,
const PxReal  minTetVolumeThreshold = 1e-8f 
)
static

Analyzes the tetrahedron mesh to get a report about deficiencies. Some deficiencies can be handled by the softbody cooker, others cannot.

Parameters
[in]pointsThe mesh's points
[in]tetrahedraThe mesh's tetrahedra (index buffer)
[in]minTetVolumeThresholdMinimum volume every tetrahedron in the mesh must have such that no volume warning is generated
Returns
Flags that describe the tetrahedron mesh's deficiencies

◆ validateTriangleMesh()

PxTriangleMeshAnalysisResults PxTetMaker::validateTriangleMesh ( const PxSimpleTriangleMesh &  triangleMesh,
const PxReal  minVolumeThreshold = 1e-6f,
const PxReal  minTriangleAngleRadians = 10.0f*3.1415926535898f / 180.0f 
)
static

Analyzes the triangle mesh to get a report about deficiencies. Some deficiencies can be handled by the tetmesher, others cannot.

Parameters
[in]triangleMeshThe description of the triangle mesh including vertices and indices
[in]minVolumeThresholdMinimum volume the mesh must have such that no volume warning is generated
[in]minTriangleAngleRadiansMinimum angle allowed for triangles such that no angle warning is generated
Returns
Flags that describe the triangle mesh's deficiencies

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