PxTetrahedronMeshExt

Defined in include/extensions/PxTetrahedronMeshExt.h

class PxTetrahedronMeshExt

utility functions for use with PxTetrahedronMesh and subclasses

Public Static Functions

static PxI32 findTetrahedronContainingPoint(const PxTetrahedronMesh *mesh, const PxVec3 &point, PxVec4 &bary, PxReal tolerance = 1e-6f)

Returns the index of the tetrahedron that contains a point.

Parameters
  • mesh[in] The tetmesh

  • point[in] The point to find the enclosing tetrahedron for

  • bary[in] The barycentric coordinates of the point inside the enclosing tetrahedron

  • tolerance[in] Tolerance value used classify points as inside if they lie exactly a tetrahedron’s surface

Returns

The index of the tetrahedon containing the point, -1 if not tetrahedron contains the opoint

static PxI32 findTetrahedronClosestToPoint(const PxTetrahedronMesh *mesh, const PxVec3 &point, PxVec4 &bary)

Returns the index of the tetrahedron closest to a point.

Parameters
  • mesh[in] The tetmesh

  • point[in] The point to find the closest tetrahedron for

  • bary[out] The barycentric coordinates of the point in the tetrahedron

Returns

The index of the tetrahedon closest to the point

static void createPointsToTetrahedronMap(const PxArray<PxVec3> &tetMeshVertices, const PxArray<PxU32> &tetMeshIndices, const PxArray<PxVec3> &pointsToEmbed, PxArray<PxVec4> &barycentricCoordinates, PxArray<PxU32> &tetLinks)

Associates points with closest tetrahedra from input tetrahedral mesh.

If the tetmesh does not have any tetrahedra or points, a warning will be generated and the result arrays will be empty, even if there are query points passed into the method.

Parameters
  • tetMeshVertices[in] The tetrahedral mesh vertices

  • tetMeshIndices[in] The tetraheral mesh indices

  • pointsToEmbed[in] The points for which the embedding should be created

  • barycentricCoordinates[in] The output barycentric coordinates for each input point relative to its closest tetrahedron

  • tetLinks[in] The output indices of the closest tetrahedron for each input point

static void extractTetMeshSurface(const void *tetrahedra, PxU32 numTetrahedra, bool sixteenBitIndices, PxArray<PxU32> &surfaceTriangles, PxArray<PxU32> *surfaceTriangleToTet = NULL, bool flipTriangleOrientation = false)

Extracts the surface triangles of a tetmesh.

The extracted triangle’s vertex indices point to the vertex buffer of the tetmesh.

Parameters
  • tetrahedra[in] The tetrahedra indices

  • numTetrahedra[in] The number of tetrahedra

  • sixteenBitIndices[in] If set to true, the tetrahedra indices are read as 16bit integers, otherwise 32bit integers are used

  • surfaceTriangles[in] The resulting surface triangles

  • surfaceTriangleToTet[in] Optional array to get the index of a tetrahedron that is adjacent to the surface triangle with the corresponding index

  • flipTriangleOrientation[in] Reverses the orientation of the ouput triangles

static void extractTetMeshSurface(const PxTetrahedronMesh *mesh, PxArray<PxU32> &surfaceTriangles, PxArray<PxU32> *surfaceTriangleToTet = NULL, bool flipTriangleOrientation = false)

Extracts the surface triangles of a tetmesh.

The extracted triangle’s vertex indices point to the vertex buffer of the tetmesh.

Parameters
  • mesh[in] The mesh from which the surface shall be computed

  • surfaceTriangles[in] The resulting surface triangles

  • surfaceTriangleToTet[in] Optional array to get the index of a tetrahedron that is adjacent to the surface triangle with the corresponding index

  • flipTriangleOrientation[in] Reverses the orientation of the ouput triangles