fix pitch_from_quaternion
This commit is contained in:
1 parent
75f1215ed2
commit
fb6248925a
3 files changed
+3
-3
No files matched your search
@@ -159,7 +159,7 @@ roll_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> f16 {
|
|||||||
|
|
||||||
@(require_results)
|
@(require_results)
|
||||||
pitch_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> f16 {
|
pitch_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> f16 {
|
||||||
y := 2 * (q.y*q.z + q.w*q.w)
|
y := 2 * (q.y*q.z + q.w*q.x)
|
||||||
x := q.w*q.w - q.x*q.x - q.y*q.y + q.z*q.z
|
x := q.w*q.w - q.x*q.x - q.y*q.y + q.z*q.z
|
||||||
|
|
||||||
if abs(x) <= F16_EPSILON && abs(y) <= F16_EPSILON {
|
if abs(x) <= F16_EPSILON && abs(y) <= F16_EPSILON {
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ roll_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> f32 {
|
|||||||
|
|
||||||
@(require_results)
|
@(require_results)
|
||||||
pitch_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> f32 {
|
pitch_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> f32 {
|
||||||
y := 2 * (q.y*q.z + q.w*q.w)
|
y := 2 * (q.y*q.z + q.w*q.x)
|
||||||
x := q.w*q.w - q.x*q.x - q.y*q.y + q.z*q.z
|
x := q.w*q.w - q.x*q.x - q.y*q.y + q.z*q.z
|
||||||
|
|
||||||
if abs(x) <= F32_EPSILON && abs(y) <= F32_EPSILON {
|
if abs(x) <= F32_EPSILON && abs(y) <= F32_EPSILON {
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ roll_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> f64 {
|
|||||||
|
|
||||||
@(require_results)
|
@(require_results)
|
||||||
pitch_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> f64 {
|
pitch_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> f64 {
|
||||||
y := 2 * (q.y*q.z + q.w*q.w)
|
y := 2 * (q.y*q.z + q.w*q.x)
|
||||||
x := q.w*q.w - q.x*q.x - q.y*q.y + q.z*q.z
|
x := q.w*q.w - q.x*q.x - q.y*q.y + q.z*q.z
|
||||||
|
|
||||||
if abs(x) <= F64_EPSILON && abs(y) <= F64_EPSILON {
|
if abs(x) <= F64_EPSILON && abs(y) <= F64_EPSILON {
|
||||||
|
|||||||
Reference in new issue
Block a user