MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / tanHalf

Function tanHalf

physx/source/foundation/include/PsMathUtils.h:573–583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

571}
572
573PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal tanHalf(PxReal sin, PxReal cos)
574{
575 // PT: avoids divide by zero for singularity. We return sqrt(FLT_MAX) instead of FLT_MAX
576 // to make sure the calling code doesn't generate INF values when manipulating the returned value
577 // (some joints multiply it by 4, etc).
578 if(cos==-1.0f)
579 return sin<0.0f ? -sqrtf(FLT_MAX) : sqrtf(FLT_MAX);
580
581 // PT: half-angle formula: tan(a/2) = sin(a)/(1+cos(a))
582 return sin / (1.0f + cos);
583}
584
585PX_INLINE PxQuat quatFromTanQVector(const PxVec3& v)
586{

Callers 4

visualizeJointMethod · 0.85
getLimitMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected