| 571 | } |
| 572 | |
| 573 | PX_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 | |
| 585 | PX_INLINE PxQuat quatFromTanQVector(const PxVec3& v) |
| 586 | { |
no outgoing calls
no test coverage detected