PxSDFSample

Defined in include/foundation/PxMathUtils.h

static inline PxReal PxSDFSample(const PxReal *sdf, const PxVec3 &localPos, const PxVec3 &sdfBoxLower, const PxVec3 &sdfBoxHigher, const PxReal sdfDx, const PxReal invSdfDx, const PxU32 dimX, const PxU32 dimY, const PxU32 dimZ, PxReal tolerance)

Samples the signed distance field (SDF) at a given local position.

This function samples the SDF at a given local position within the defined box bounds and calculates the interpolated distance value. It handles grid clamping and ensures that the sampled value is within the tolerance limit.

See also

PxTriLerp PxSDFIdx

Parameters
  • sdf[in] A pointer to the SDF data

  • localPos[in] The local position to sample the SDF

  • sdfBoxLower[in] The lower bound of the SDF box

  • sdfBoxHigher[in] The upper bound of the SDF box

  • sdfDx[in] The spacing between grid points in the SDF

  • invSdfDx[in] The inverse of the grid spacing

  • dimX[in] The number of grid points along the x-axis

  • dimY[in] The number of grid points along the y-axis

  • dimZ[in] The number of grid points along the z-axis

  • tolerance[in] The tolerance for clamping the grid points

Returns

The sampled SDF value