PxSamplingExt
Defined in include/extensions/PxSamplingExt.h
-
class PxSamplingExt
utility functions to sample vertices on or inside a triangle mesh or other geometries
Public Static Functions
-
static bool poissonSample(const PxSimpleTriangleMesh &mesh, PxReal r, PxArray<PxVec3> &result, PxReal rVolume = 0.0f, PxArray<PxI32> *triangleIds = NULL, PxArray<PxVec3> *barycentricCoordinates = NULL, const PxBounds3 *axisAlignedBox = NULL, const PxQuat *boxOrientation = NULL, PxU32 maxNumSamples = 0, PxU32 numSampleAttemptsAroundPoint = 30)
Computes samples on a triangle mesh’s surface that are not closer to each other than a given distance.
Optionally the mesh’s interior can be filled with samples as well.
- Parameters
mesh – [in] The triangle mesh
r – [in] The closest distance two surface samples are allowed to have
result – [out] Equally distributed samples on and if specified inside the triangle mesh
rVolume – [in] The average distance of samples inside the mesh. If set to zero, samples will only be placed on the mesh’s surface
triangleIds – [out] Optional output containing the index of the triangle for all samples on the mesh’s surface. The array will contain less entries than output vertices if volume samples are active since volume samples are not on the surface.
barycentricCoordinates – [out] Optional output containing the barycentric coordinates for all samples on the mesh’s surface. The array will contain less entries than output vertices if volume samples are active since volume samples are not on the surface.
axisAlignedBox – [in] A box that limits the space where samples can get created
boxOrientation – [in] The orientation of the box that limits the space where samples can get created
maxNumSamples – [in] If larger than zero, the sampler will stop when the sample count reaches maxNumSamples
numSampleAttemptsAroundPoint – [in] Number of repetitions the underlying algorithm performs to find a new valid sample that matches all criteria like minimal distance to existing samples etc.
- Returns
Returns true if the sampling was successful and false if there was a problem. Usually an internal overflow is the problem for very big meshes or very small sampling radii.
-
static bool poissonSample(const PxGeometry &geometry, const PxTransform &transform, const PxBounds3 &worldBounds, PxReal r, PxArray<PxVec3> &result, PxReal rVolume = 0.0f, const PxBounds3 *axisAlignedBox = NULL, const PxQuat *boxOrientation = NULL, PxU32 maxNumSamples = 0, PxU32 numSampleAttemptsAroundPoint = 30)
Computes samples on a geometry’s surface that are not closer to each other than a given distance.
- Parameters
geometry – [in] The geometry that defines the surface on which the samples get created
transform – [in] The geometry’s global pose
worldBounds – [in] The geometry’s bounding box
r – [in] The closest distance two surface samples are allowed to have
result – [out] Equally distributed samples on and if specified inside the triangle mesh
rVolume – [in] The average distance of samples inside the mesh. If set to zero, samples will only be placed on the mesh’s surface
axisAlignedBox – [in] A box that limits the space where samples can get created
boxOrientation – [in] The orientation of the box that limits the space where samples can get created
maxNumSamples – [in] If larger than zero, the sampler will stop when the sample count reaches maxNumSamples
numSampleAttemptsAroundPoint – [in] Number of repetitions the underlying algorithm performs to find a new valid sample that matches all criteria like minimal distance to existing samples etc.
- Returns
Returns true if the sampling was successful and false if there was a problem. Usually an internal overflow is the problem for very big meshes or very small sampling radii.
-
static bool poissonSample(const PxSimpleTriangleMesh &mesh, PxReal r, PxArray<PxVec3> &result, PxReal rVolume = 0.0f, PxArray<PxI32> *triangleIds = NULL, PxArray<PxVec3> *barycentricCoordinates = NULL, const PxBounds3 *axisAlignedBox = NULL, const PxQuat *boxOrientation = NULL, PxU32 maxNumSamples = 0, PxU32 numSampleAttemptsAroundPoint = 30)