RavEngine
Loading...
Searching...
No Matches
PxTetMakerExt.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef PX_TETMAKER_EXT_H
30#define PX_TETMAKER_EXT_H
35#include "foundation/PxSimpleTypes.h"
36#include "foundation/PxVec3.h"
37#include "common/PxCoreUtilityTypes.h"
38#include "foundation/PxArray.h"
39#include "PxTriangleMeshAnalysisResult.h"
40#include "PxTetrahedronMeshAnalysisResult.h"
41
42#if !PX_DOXYGEN
43namespace physx
44{
45#endif
46
47class PxTriangleMesh;
48class PxTetrahedronMeshDesc;
49class PxSoftBodySimulationDataDesc;
50struct PxTetMakerData;
51class PxSimpleTriangleMesh;
52
57{
58public:
59
71 const bool validate = true, PxReal volumeThreshold = 0.0f);
72
84 static bool createVoxelTetrahedronMesh(const PxTetrahedronMeshDesc& tetMesh, const PxU32 numVoxelsAlongLongestBoundingBoxAxis,
85 physx::PxArray<physx::PxVec3>& outVertices, physx::PxArray<physx::PxU32>& outTetIndices, PxI32* inputPointToOutputTetIndex = NULL, const PxU32* anchorNodeIndices = NULL);
86
98 static bool createVoxelTetrahedronMeshFromEdgeLength(const PxTetrahedronMeshDesc& tetMesh, const PxReal voxelEdgeLength,
99 physx::PxArray<physx::PxVec3>& outVertices, physx::PxArray<physx::PxU32>& outTetIndices, PxI32* inputPointToOutputTetIndex = NULL, const PxU32* anchorNodeIndices = NULL);
100
109 static PxTriangleMeshAnalysisResults validateTriangleMesh(const PxSimpleTriangleMesh& triangleMesh, const PxReal minVolumeThreshold = 1e-6f, const PxReal minTriangleAngleRadians = 10.0f*3.1415926535898f / 180.0f);
110
119 static PxTetrahedronMeshAnalysisResults validateTetrahedronMesh(const PxBoundedData& points, const PxBoundedData& tetrahedra, const PxReal minTetVolumeThreshold = 1e-8f);
120
134 static void simplifyTriangleMesh(const PxArray<PxVec3>& inputVertices, const PxArray<PxU32>&inputIndices, int targetTriangleCount, PxF32 maximalEdgeLength,
135 PxArray<PxVec3>& outputVertices, PxArray<PxU32>& outputIndices,
136 PxArray<PxU32> *vertexMap = NULL, PxReal edgeLengthCostWeight = 0.1f, PxReal flatnessDetectionThreshold = 0.01f);
137
148 static void remeshTriangleMesh(const PxArray<PxVec3>& inputVertices, const PxArray<PxU32>&inputIndices, int gridResolution,
149 PxArray<PxVec3>& outputVertices, PxArray<PxU32>& outputIndices,
150 PxArray<PxU32> *vertexMap = NULL);
151
162 static void createTreeBasedTetrahedralMesh(const PxArray<PxVec3>& inputVertices, const PxArray<PxU32>&inputIndices,
163 bool useTreeNodes, PxArray<PxVec3>& outputVertices, PxArray<PxU32>& outputIndices, PxReal volumeThreshold = 0.0f);
164
176 static void createRelaxedVoxelTetrahedralMesh(const PxArray<PxVec3>& inputVertices, const PxArray<PxU32>&inputIndices,
177 PxArray<PxVec3>& outputVertices, PxArray<PxU32>& outputIndices,
178 PxI32 resolution, PxI32 numRelaxationIterations = 5, PxF32 relMinTetVolume = 0.05f);
179
180};
181
182#if !PX_DOXYGEN
183}
184#endif
185
187#endif
188
Definition PxArray.h:53
Container for bitfield flag variables associated with a specific enum type.
Definition PxFlags.h:73
A structure describing a triangle mesh.
Definition PxSimpleTriangleMesh.h:83
Provides functionality to create a tetrahedral mesh from a triangle mesh.
Definition PxTetMakerExt.h:57
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...
Definition ExtTetMakerExt.cpp:174
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 f...
Definition ExtTetMakerExt.cpp:189
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.
Definition ExtTetMakerExt.cpp:215
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.
Definition ExtTetMakerExt.cpp:155
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.
Definition ExtTetMakerExt.cpp:128
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 th...
Definition ExtTetMakerExt.cpp:169
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.
Definition ExtTetMakerExt.cpp:179
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.
Definition ExtTetMakerExt.cpp:162
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.
Definition ExtTetMakerExt.cpp:198
Descriptor class for #PxTetrahedronMesh (contains only pure geometric data).
Definition PxTetrahedronMeshDesc.h:52
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition PxCoreUtilityTypes.h:96