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

Function QuatToEuler

physx/samples/samplebase/SampleCameraController.cpp:61–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59static PxReal gGamepadLateralInc = 0.0f;
60
61static PxVec3 QuatToEuler(const PxQuat& q)
62{
63 PxVec3 dir = -PxMat33(q)[2];
64 PxReal r = PxSqrt(dir.x * dir.x + dir.z * dir.z);
65 PxVec3 rot(0.0f, PxHalfPi, 0.0f);
66 if (r != 0.0f)
67 {
68 rot.x = -PxAtan(dir.y / r);
69 rot.y = PxAsin(dir.x / r);
70 if (dir.z > 0.0f)
71 rot.y = PxPi - rot.y;
72 }
73
74 return rot;
75}
76
77///////////////////////////////////////////////////////////////////////////////
78

Callers 1

initMethod · 0.85

Calls 4

PxSqrtFunction · 0.85
PxAtanFunction · 0.85
PxAsinFunction · 0.85
PxMat33Class · 0.50

Tested by

no test coverage detected