From ea72107b2715be4c1ea3d2d8f2c67c1d555b6476 Mon Sep 17 00:00:00 2001 From: sergeypdev Date: Sun, 3 Mar 2024 19:04:15 +0400 Subject: [PATCH] Fix build on zig 0.12 --- src/mat3.zig | 6 +++--- src/mat4.zig | 6 +++--- src/quaternion.zig | 2 -- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/mat3.zig b/src/mat3.zig index 0a363bf..224eb75 100644 --- a/src/mat3.zig +++ b/src/mat3.zig @@ -176,12 +176,12 @@ pub fn Mat3x3(comptime T: type) type { pub fn extractEulerAngles(self: Self) Vector3 { const m = self.orthoNormalize(); - const theta_x = math.atan2(T, m.data[1][2], m.data[2][2]); + const theta_x = math.atan2(m.data[1][2], m.data[2][2]); const c2 = @sqrt(math.pow(T, m.data[0][0], 2) + math.pow(T, m.data[0][1], 2)); - const theta_y = math.atan2(T, -m.data[0][2], @sqrt(c2)); + const theta_y = math.atan2(-m.data[0][2], @sqrt(c2)); const s1 = @sin(theta_x); const c1 = @cos(theta_x); - const theta_z = math.atan2(T, s1 * m.data[2][0] - c1 * m.data[1][0], c1 * m.data[1][1] - s1 * m.data[2][1]); + const theta_z = math.atan2(s1 * m.data[2][0] - c1 * m.data[1][0], c1 * m.data[1][1] - s1 * m.data[2][1]); return Vector3.new(root.toDegrees(theta_x), root.toDegrees(theta_y), root.toDegrees(theta_z)); } diff --git a/src/mat4.zig b/src/mat4.zig index e8ec3b3..2f5c738 100644 --- a/src/mat4.zig +++ b/src/mat4.zig @@ -206,12 +206,12 @@ pub fn Mat4x4(comptime T: type) type { pub fn extractEulerAngles(self: Self) Vector3 { const m = self.orthoNormalize(); - const theta_x = math.atan2(T, m.data[1][2], m.data[2][2]); + const theta_x = math.atan2(m.data[1][2], m.data[2][2]); const c2 = @sqrt(math.pow(T, m.data[0][0], 2) + math.pow(T, m.data[0][1], 2)); - const theta_y = math.atan2(T, -m.data[0][2], @sqrt(c2)); + const theta_y = math.atan2(-m.data[0][2], @sqrt(c2)); const s1 = @sin(theta_x); const c1 = @cos(theta_x); - const theta_z = math.atan2(T, s1 * m.data[2][0] - c1 * m.data[1][0], c1 * m.data[1][1] - s1 * m.data[2][1]); + const theta_z = math.atan2(s1 * m.data[2][0] - c1 * m.data[1][0], c1 * m.data[1][1] - s1 * m.data[2][1]); return Vector3.new(root.toDegrees(theta_x), root.toDegrees(theta_y), root.toDegrees(theta_z)); } diff --git a/src/quaternion.zig b/src/quaternion.zig index dac50c4..5efe424 100644 --- a/src/quaternion.zig +++ b/src/quaternion.zig @@ -251,7 +251,6 @@ pub fn Quaternion(comptime T: type) type { /// Extract euler angles (degrees) from quaternion. pub fn extractEulerAngles(self: Self) Vector3 { const yaw = math.atan2( - T, 2 * (self.y * self.z + self.w * self.x), self.w * self.w - self.x * self.x - self.y * self.y + self.z * self.z, ); @@ -259,7 +258,6 @@ pub fn Quaternion(comptime T: type) type { -2 * (self.x * self.z - self.w * self.y), ); const roll = math.atan2( - T, 2 * (self.x * self.y + self.w * self.z), self.w * self.w + self.x * self.x - self.y * self.y - self.z * self.z, );