Class PxTetMaker

java.lang.Object
physx.NativeObject
physx.geometry.PxTetMaker

public class PxTetMaker extends NativeObject
Provides functionality to create a tetrahedral mesh from a triangle mesh.
  • Field Details

    • SIZEOF

      public static final int SIZEOF
    • ALIGNOF

      public static final int ALIGNOF
      See Also:
  • Constructor Details

    • PxTetMaker

      protected PxTetMaker()
    • PxTetMaker

      protected PxTetMaker(long address)
  • Method Details

    • wrapPointer

      public static PxTetMaker wrapPointer(long address)
    • arrayGet

      public static PxTetMaker arrayGet(long baseAddress, int index)
    • createConformingTetrahedronMesh

      public static boolean createConformingTetrahedronMesh(PxSimpleTriangleMesh triangleMesh, PxArray_PxVec3 outVertices, PxArray_PxU32 outTetIndices, boolean validate, float volumeThreshold)
      Create conforming tetrahedron mesh using TetMaker
      Parameters:
      triangleMesh - The description of the triangle mesh including vertices and indices
      outVertices - The vertices to store the conforming tetrahedral mesh
      outTetIndices - The indices to store the conforming tetrahedral mesh
      validate - If set to true the input triangle mesh will get analyzed to find possible deficiencies
      volumeThreshold - Tetrahedra with a volume smaller than the specified threshold will be removed from the mesh
      Returns:
      True if success
    • createVoxelTetrahedronMesh

      public static boolean createVoxelTetrahedronMesh(PxTetrahedronMeshDesc tetMesh, int numVoxelsAlongLongestBoundingBoxAxis, PxArray_PxVec3 outVertices, PxArray_PxU32 outTetIndices)
      Create voxel-based tetrahedron mesh using TetMaker
      Parameters:
      tetMesh - The description of the tetrahedral mesh including vertices and indices
      numVoxelsAlongLongestBoundingBoxAxis - The number of voxels along the longest bounding box axis
      outVertices - The vertices to store the voxel-based tetrahedral mesh
      outTetIndices - The indices to store the voxel-based tetrahedral mesh
      Returns:
      True if success
    • createVoxelTetrahedronMeshFromEdgeLength

      public static boolean createVoxelTetrahedronMeshFromEdgeLength(PxTetrahedronMeshDesc tetMesh, float voxelEdgeLength, PxArray_PxVec3 outVertices, PxArray_PxU32 outTetIndices)
      Create voxel-based tetrahedron mesh using TetMaker
      Parameters:
      tetMesh - The description of the tetrahedral mesh including vertices and indices
      voxelEdgeLength - The edge length of a voxel.Can be adjusted slightly such that a multiple of it matches the input points' bounding box size
      outVertices - The vertices to store the voxel-based tetrahedral mesh
      outTetIndices - The indices to store the voxel-based tetrahedral mesh
      Returns:
      True if success
    • validateTriangleMesh

      public static PxTriangleMeshAnalysisResults validateTriangleMesh(PxSimpleTriangleMesh triangleMesh, float minVolumeThreshold, float minTriangleAngleRadians)
      Analyzes the triangle mesh to get a report about deficiencies. Some deficiencies can be handled by the tetmesher, others cannot.
      Parameters:
      triangleMesh - The description of the triangle mesh including vertices and indices
      minVolumeThreshold - Minimum volume the mesh must have such that no volume warning is generated
      minTriangleAngleRadians - Minimum angle allowed for triangles such that no angle warning is generated
      Returns:
      Flags that describe the triangle mesh's deficiencies
    • validateTetrahedronMesh

      public static PxTetrahedronMeshAnalysisResults validateTetrahedronMesh(PxBoundedData points, PxBoundedData tetrahedra, float minTetVolumeThreshold)
      Analyzes the tetrahedron mesh to get a report about deficiencies. Some deficiencies can be handled by the softbody cooker, others cannot.
      Parameters:
      points - The mesh's points
      tetrahedra - The mesh's tetrahedra (index buffer)
      minTetVolumeThreshold - Minimum volume every tetrahedron in the mesh must have such that no volume warning is generated
      Returns:
      Flags that describe the tetrahedron mesh's deficiencies
    • simplifyTriangleMesh

      public static void simplifyTriangleMesh(PxArray_PxVec3 inputVertices, PxArray_PxU32 inputIndices, int targetTriangleCount, float maximalEdgeLength, PxArray_PxVec3 outputVertices, PxArray_PxU32 outputIndices)
      Simplifies (decimates) a triangle mesh using quadric simplification.
      Parameters:
      inputVertices - The vertices of the input triangle mesh
      inputIndices - The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      targetTriangleCount - Desired number of triangles in the output mesh
      maximalEdgeLength - Edges below this length will not be collapsed. A value of zero means there is no limit.
      outputVertices - The vertices of the output (decimated) triangle mesh
      outputIndices - The indices of the output (decimated) triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
    • simplifyTriangleMesh

      public static void simplifyTriangleMesh(PxArray_PxVec3 inputVertices, PxArray_PxU32 inputIndices, int targetTriangleCount, float maximalEdgeLength, PxArray_PxVec3 outputVertices, PxArray_PxU32 outputIndices, PxArray_PxU32 vertexMap)
      Simplifies (decimates) a triangle mesh using quadric simplification.
      Parameters:
      inputVertices - The vertices of the input triangle mesh
      inputIndices - The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      targetTriangleCount - Desired number of triangles in the output mesh
      maximalEdgeLength - Edges below this length will not be collapsed. A value of zero means there is no limit.
      outputVertices - The vertices of the output (decimated) triangle mesh
      outputIndices - The indices of the output (decimated) triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      vertexMap - Optional parameter which returns the mapping from input to output vertices. Note that multiple input vertices are typically collapsed into the same output vertex.
    • simplifyTriangleMesh

      public static void simplifyTriangleMesh(PxArray_PxVec3 inputVertices, PxArray_PxU32 inputIndices, int targetTriangleCount, float maximalEdgeLength, PxArray_PxVec3 outputVertices, PxArray_PxU32 outputIndices, PxArray_PxU32 vertexMap, float edgeLengthCostWeight)
      Simplifies (decimates) a triangle mesh using quadric simplification.
      Parameters:
      inputVertices - The vertices of the input triangle mesh
      inputIndices - The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      targetTriangleCount - Desired number of triangles in the output mesh
      maximalEdgeLength - Edges below this length will not be collapsed. A value of zero means there is no limit.
      outputVertices - The vertices of the output (decimated) triangle mesh
      outputIndices - The indices of the output (decimated) triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      vertexMap - Optional parameter which returns the mapping from input to output vertices. Note that multiple input vertices are typically collapsed into the same output vertex.
      edgeLengthCostWeight - Factor to scale influence of edge length when prioritizing edge collapses. Has no effect if set to zero.
    • simplifyTriangleMesh

      public static void simplifyTriangleMesh(PxArray_PxVec3 inputVertices, PxArray_PxU32 inputIndices, int targetTriangleCount, float maximalEdgeLength, PxArray_PxVec3 outputVertices, PxArray_PxU32 outputIndices, PxArray_PxU32 vertexMap, float edgeLengthCostWeight, float flatnessDetectionThreshold)
      Simplifies (decimates) a triangle mesh using quadric simplification.
      Parameters:
      inputVertices - The vertices of the input triangle mesh
      inputIndices - The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      targetTriangleCount - Desired number of triangles in the output mesh
      maximalEdgeLength - Edges below this length will not be collapsed. A value of zero means there is no limit.
      outputVertices - The vertices of the output (decimated) triangle mesh
      outputIndices - The indices of the output (decimated) triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      vertexMap - Optional parameter which returns the mapping from input to output vertices. Note that multiple input vertices are typically collapsed into the same output vertex.
      edgeLengthCostWeight - Factor to scale influence of edge length when prioritizing edge collapses. Has no effect if set to zero.
      flatnessDetectionThreshold - Threshold 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.
    • simplifyTriangleMesh

      public static void simplifyTriangleMesh(PxArray_PxVec3 inputVertices, PxArray_PxU32 inputIndices, int targetTriangleCount, float maximalEdgeLength, PxArray_PxVec3 outputVertices, PxArray_PxU32 outputIndices, PxArray_PxU32 vertexMap, float edgeLengthCostWeight, float flatnessDetectionThreshold, boolean projectSimplifiedPointsOnInputMeshSurface)
      Simplifies (decimates) a triangle mesh using quadric simplification.
      Parameters:
      inputVertices - The vertices of the input triangle mesh
      inputIndices - The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      targetTriangleCount - Desired number of triangles in the output mesh
      maximalEdgeLength - Edges below this length will not be collapsed. A value of zero means there is no limit.
      outputVertices - The vertices of the output (decimated) triangle mesh
      outputIndices - The indices of the output (decimated) triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      vertexMap - Optional parameter which returns the mapping from input to output vertices. Note that multiple input vertices are typically collapsed into the same output vertex.
      edgeLengthCostWeight - Factor to scale influence of edge length when prioritizing edge collapses. Has no effect if set to zero.
      flatnessDetectionThreshold - Threshold 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.
      projectSimplifiedPointsOnInputMeshSurface - If set to true, the simplified points will lie exactly on the original surface.
    • simplifyTriangleMesh

      public static void simplifyTriangleMesh(PxArray_PxVec3 inputVertices, PxArray_PxU32 inputIndices, int targetTriangleCount, float maximalEdgeLength, PxArray_PxVec3 outputVertices, PxArray_PxU32 outputIndices, PxArray_PxU32 vertexMap, float edgeLengthCostWeight, float flatnessDetectionThreshold, boolean projectSimplifiedPointsOnInputMeshSurface, PxArray_PxU32 outputVertexToInputTriangle)
      Simplifies (decimates) a triangle mesh using quadric simplification.
      Parameters:
      inputVertices - The vertices of the input triangle mesh
      inputIndices - The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      targetTriangleCount - Desired number of triangles in the output mesh
      maximalEdgeLength - Edges below this length will not be collapsed. A value of zero means there is no limit.
      outputVertices - The vertices of the output (decimated) triangle mesh
      outputIndices - The indices of the output (decimated) triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      vertexMap - Optional parameter which returns the mapping from input to output vertices. Note that multiple input vertices are typically collapsed into the same output vertex.
      edgeLengthCostWeight - Factor to scale influence of edge length when prioritizing edge collapses. Has no effect if set to zero.
      flatnessDetectionThreshold - Threshold 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.
      projectSimplifiedPointsOnInputMeshSurface - If set to true, the simplified points will lie exactly on the original surface.
      outputVertexToInputTriangle - Optional indices providing the triangle index per resulting vertex. Only available when projectSimplifiedPointsOnInputMeshSurface is set to true
    • simplifyTriangleMesh

      public static void simplifyTriangleMesh(PxArray_PxVec3 inputVertices, PxArray_PxU32 inputIndices, int targetTriangleCount, float maximalEdgeLength, PxArray_PxVec3 outputVertices, PxArray_PxU32 outputIndices, PxArray_PxU32 vertexMap, float edgeLengthCostWeight, float flatnessDetectionThreshold, boolean projectSimplifiedPointsOnInputMeshSurface, PxArray_PxU32 outputVertexToInputTriangle, boolean removeDisconnectedPatches)
      Simplifies (decimates) a triangle mesh using quadric simplification.
      Parameters:
      inputVertices - The vertices of the input triangle mesh
      inputIndices - The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      targetTriangleCount - Desired number of triangles in the output mesh
      maximalEdgeLength - Edges below this length will not be collapsed. A value of zero means there is no limit.
      outputVertices - The vertices of the output (decimated) triangle mesh
      outputIndices - The indices of the output (decimated) triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      vertexMap - Optional parameter which returns the mapping from input to output vertices. Note that multiple input vertices are typically collapsed into the same output vertex.
      edgeLengthCostWeight - Factor to scale influence of edge length when prioritizing edge collapses. Has no effect if set to zero.
      flatnessDetectionThreshold - Threshold 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.
      projectSimplifiedPointsOnInputMeshSurface - If set to true, the simplified points will lie exactly on the original surface.
      outputVertexToInputTriangle - Optional indices providing the triangle index per resulting vertex. Only available when projectSimplifiedPointsOnInputMeshSurface is set to true
      removeDisconnectedPatches - Enables the optional removal of disconnected triangles in the mesh. Only the largest connected set/patch will be kept
    • remeshTriangleMesh

      public static void remeshTriangleMesh(PxArray_PxVec3 inputVertices, PxArray_PxU32 inputIndices, int gridResolution, PxArray_PxVec3 outputVertices, PxArray_PxU32 outputIndices)
      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:
      inputVertices - The vertices of the input triangle mesh
      inputIndices - The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      gridResolution - Size of the voxel grid (number of voxels along the longest dimension)
      outputVertices - The vertices of the output (decimated) triangle mesh
      outputIndices - The indices of the output (decimated) triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
    • remeshTriangleMesh

      public static void remeshTriangleMesh(PxArray_PxVec3 inputVertices, PxArray_PxU32 inputIndices, int gridResolution, PxArray_PxVec3 outputVertices, PxArray_PxU32 outputIndices, PxArray_PxU32 vertexMap)
      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:
      inputVertices - The vertices of the input triangle mesh
      inputIndices - The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      gridResolution - Size of the voxel grid (number of voxels along the longest dimension)
      outputVertices - The vertices of the output (decimated) triangle mesh
      outputIndices - The indices of the output (decimated) triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      vertexMap - Optional 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.
    • createTreeBasedTetrahedralMesh

      public static void createTreeBasedTetrahedralMesh(PxArray_PxVec3 inputVertices, PxArray_PxU32 inputIndices, boolean useTreeNodes, PxArray_PxVec3 outputVertices, PxArray_PxU32 outputIndices, float volumeThreshold)
      Creates a tetrahedral mesh using an octree.
      Parameters:
      inputVertices - The vertices of the input triangle mesh
      inputIndices - The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      useTreeNodes - Using the nodes of the octree as tetrahedral vertices
      outputVertices - The vertices of the output tetrahedral mesh
      outputIndices - The indices of the output tetrahedral mesh of the form (id0, id1, id2, id3), (id0, id1, id2, id3), ..
      volumeThreshold - Tetrahedra with a volume smaller than the specified threshold will be removed from the mesh
    • createRelaxedVoxelTetrahedralMesh

      public static void createRelaxedVoxelTetrahedralMesh(PxArray_PxVec3 inputVertices, PxArray_PxU32 inputIndices, PxArray_PxVec3 outputVertices, PxArray_PxU32 outputIndices, int resolution)
      Creates a tetrahedral mesh by relaxing a voxel mesh around the input mesh
      Parameters:
      inputVertices - The vertices of the input triangle mesh
      inputIndices - The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      outputVertices - The vertices of the output tetrahedral mesh
      outputIndices - The indices of the output tetrahedral mesh of the form (id0, id1, id2, id3), (id0, id1, id2, id3), ..
      resolution - The grid spacing is computed as the diagonal of the bounding box of the input mesh divided by the resolution.
    • createRelaxedVoxelTetrahedralMesh

      public static void createRelaxedVoxelTetrahedralMesh(PxArray_PxVec3 inputVertices, PxArray_PxU32 inputIndices, PxArray_PxVec3 outputVertices, PxArray_PxU32 outputIndices, int resolution, int numRelaxationIterations)
      Creates a tetrahedral mesh by relaxing a voxel mesh around the input mesh
      Parameters:
      inputVertices - The vertices of the input triangle mesh
      inputIndices - The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      outputVertices - The vertices of the output tetrahedral mesh
      outputIndices - The indices of the output tetrahedral mesh of the form (id0, id1, id2, id3), (id0, id1, id2, id3), ..
      resolution - The grid spacing is computed as the diagonal of the bounding box of the input mesh divided by the resolution.
      numRelaxationIterations - Number of iterations to pull the tetrahedral mesh towards the input mesh
    • createRelaxedVoxelTetrahedralMesh

      public static void createRelaxedVoxelTetrahedralMesh(PxArray_PxVec3 inputVertices, PxArray_PxU32 inputIndices, PxArray_PxVec3 outputVertices, PxArray_PxU32 outputIndices, int resolution, int numRelaxationIterations, float relMinTetVolume)
      Creates a tetrahedral mesh by relaxing a voxel mesh around the input mesh
      Parameters:
      inputVertices - The vertices of the input triangle mesh
      inputIndices - The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      outputVertices - The vertices of the output tetrahedral mesh
      outputIndices - The indices of the output tetrahedral mesh of the form (id0, id1, id2, id3), (id0, id1, id2, id3), ..
      resolution - The grid spacing is computed as the diagonal of the bounding box of the input mesh divided by the resolution.
      numRelaxationIterations - Number of iterations to pull the tetrahedral mesh towards the input mesh
      relMinTetVolume - Constrains the volumes of the tetrahedra to stay abobe relMinTetvolume times the tetrahedron's rest volume.
    • detectTriangleIslands

      public static void detectTriangleIslands(PxI32ConstPtr triangles, int numTriangles, PxArray_PxU32 islandIndexPerTriangle)
      Creates a tetrahedral mesh by relaxing a voxel mesh around the input mesh
      Parameters:
      triangles - The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), ..
      numTriangles - The number of triangles
      islandIndexPerTriangle - Every triangle gets an island index assigned. Triangles with the same island index belong to the same patch of connected triangles.
    • findLargestIslandId

      public static int findLargestIslandId(PxU32ConstPtr islandIndexPerTriangle, int numTriangles)
      Creates a tetrahedral mesh by relaxing a voxel mesh around the input mesh
      Parameters:
      islandIndexPerTriangle - An island marker per triangles. All triangles with the same marker belong to an island. Can becomputed using the method detectTriangleIslands.
      numTriangles - The number of triangles
      Returns:
      The marker value of the island that contains the most triangles