36#include "foundation/PxPreprocessor.h"
41#pragma warning(disable : 4985)
49#include "foundation/PxMathIntrinsics.h"
50#include "foundation/PxAssert.h"
58static const float PxPi = float(3.141592653589793);
59static const float PxHalfPi = float(1.57079632679489661923);
60static const float PxTwoPi = float(6.28318530717958647692);
61static const float PxInvPi = float(0.31830988618379067154);
62static const float PxInvTwoPi = float(0.15915494309189533577);
63static const float PxPiDivTwo = float(1.57079632679489661923);
64static const float PxPiDivFour = float(0.78539816339744830962);
65static const float PxSqrt2 = float(1.4142135623730951);
66static const float PxInvSqrt2 = float(0.7071067811865476);
81 return intrinsics::selectMax(a, b);
97 return intrinsics::selectMin(a, b);
111 return intrinsics::abs(a);
114PX_CUDA_CALLABLE
PX_FORCE_INLINE bool PxEquals(
float a,
float b,
float eps)
116 return (
PxAbs(a - b) < eps);
148 return intrinsics::sqrt(a);
160 return intrinsics::recipSqrt(a);
166 return 1 / ::sqrt(a);
180 return intrinsics::sin(a);
192 return intrinsics::cos(a);
204#if defined(__CUDACC__) && __CUDA_ARCH__ >= 350
205 __sincosf(a, &sin, &cos);
244 return ::asinf(
PxClamp(f, -1.0f, 1.0f));
254 return ::asin(
PxClamp(f, -1.0, 1.0));
264 return ::acosf(
PxClamp(f, -1.0f, 1.0f));
274 return ::acos(
PxClamp(f, -1.0, 1.0));
304 return ::atan2f(x, y);
314 return ::atan2(x, y);
322 return 0.01745329251994329547f * a;
328 return intrinsics::isFinite(f);
334 return intrinsics::isFinite(f);
354 return physx::intrinsics::sign(a);
357PX_CUDA_CALLABLE
PX_FORCE_INLINE float PxSign2(
float a,
float eps = FLT_EPSILON)
359 return (a < -eps) ? -1.0f : (a > eps) ? 1.0f : 0.0f;
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxCos(float a)
Cosine of an angle (Unit: Radians)
Definition PxMath.h:190
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAtan2(float x, float y)
Arctangent of (x/y) with correct sign. Returns angle between -PI and PI in radians Unit: Radians.
Definition PxMath.h:302
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAbs(float a)
abs returns the absolute value of its argument.
Definition PxMath.h:109
PX_CUDA_CALLABLE PX_FORCE_INLINE PxF32 PxSqr(const PxF32 a)
square of the argument
Definition PxMath.h:170
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxRecipSqrt(float a)
reciprocal square root.
Definition PxMath.h:158
PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxIsFinite(float f)
returns true if the passed number is a finite floating point number as opposed to INF,...
Definition PxMath.h:326
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxSqrt(float a)
Square root.
Definition PxMath.h:146
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAsin(float f)
Arcsine. Returns angle between -PI/2 and PI/2 in radians Unit: Radians.
Definition PxMath.h:242
PX_CUDA_CALLABLE PX_FORCE_INLINE T PxMax(T a, T b)
The return value is the greater of the two specified values.
Definition PxMath.h:72
PX_CUDA_CALLABLE PX_FORCE_INLINE void PxSinCos(const PxF32 a, PxF32 &sin, PxF32 &cos)
compute sine and cosine at the same time
Definition PxMath.h:202
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAtan(float a)
ArcTangent. Returns angle between -PI/2 and PI/2 in radians Unit: Radians.
Definition PxMath.h:282
PX_CUDA_CALLABLE PX_FORCE_INLINE PxF32 PxDegToRad(const PxF32 a)
Converts degrees to radians.
Definition PxMath.h:320
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAcos(float f)
Arccosine. Returns angle between 0 and PI in radians Unit: Radians.
Definition PxMath.h:262
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxTan(float a)
Tangent of an angle. Unit: Radians.
Definition PxMath.h:223
PX_CUDA_CALLABLE PX_FORCE_INLINE T PxMin(T a, T b)
The return value is the lesser of the two specified values.
Definition PxMath.h:88
PX_CUDA_CALLABLE PX_FORCE_INLINE T PxClamp(T v, T lo, T hi)
Clamps v to the range [hi,lo].
Definition PxMath.h:139
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxSin(float a)
trigonometry – all angles are in radians.
Definition PxMath.h:178