mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
fix pitch_from_quaternion
This commit is contained in:
@@ -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