mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-20 13:25:19 +00:00
Merge pull request #3642 from 2nafish117/fix-pitch-from-quat
Fix pitch_from_quaternion
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user