| 339 | } |
| 340 | |
| 341 | Quaternion* TriQuaternionArcFromForward( |
| 342 | Quaternion* out, |
| 343 | const Vector3* v ) |
| 344 | { |
| 345 | Vector3 temp = Normalize( *v ); |
| 346 | if( temp.z < 0.99999f ) |
| 347 | { |
| 348 | temp.z = 1.0f - temp.z; |
| 349 | temp.z = sqrtf( temp.z ); |
| 350 | float div = 0.707106781187f / temp.z; |
| 351 | *out = Quaternion( temp.y * div, -temp.x * div, 0.0f, 0.707106781187f * temp.z ); |
| 352 | return out; |
| 353 | } |
| 354 | *out = Quaternion( 1.0f, 0.0f, 0.0f, 0.0f ); |
| 355 | return out; |
| 356 | } |
| 357 | |
| 358 | void TriQuaternionToYawPitchRoll( |
| 359 | float* yaw, |
no test coverage detected