Browse Source

fix pitch_from_quaternion

shashank 1 year ago
parent
commit
fb6248925a

+ 1 - 1
core/math/linalg/specific_euler_angles_f16.odin

@@ -159,7 +159,7 @@ roll_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> f16 {
 
 @(require_results)
 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
 
 	if abs(x) <= F16_EPSILON && abs(y) <= F16_EPSILON {

+ 1 - 1
core/math/linalg/specific_euler_angles_f32.odin

@@ -159,7 +159,7 @@ roll_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> f32 {
 
 @(require_results)
 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
 
 	if abs(x) <= F32_EPSILON && abs(y) <= F32_EPSILON {

+ 1 - 1
core/math/linalg/specific_euler_angles_f64.odin

@@ -159,7 +159,7 @@ roll_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> f64 {
 
 @(require_results)
 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
 
 	if abs(x) <= F64_EPSILON && abs(y) <= F64_EPSILON {