From 88bada3c32ba3f1d53073a003085131d60b09213 Mon Sep 17 00:00:00 2001 From: John McCutchan Date: Wed, 26 Jul 2023 07:47:08 -0700 Subject: [PATCH] Revert "Fix rotation around Y axis (#262)" (#300) This reverts commit 048777a93ecc2918cdb6e0353359e6e548cb907b. --- lib/src/vector_math/matrix3.dart | 4 ++-- lib/src/vector_math_64/matrix3.dart | 4 ++-- test/matrix3_test.dart | 26 +------------------------- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/lib/src/vector_math/matrix3.dart b/lib/src/vector_math/matrix3.dart index cea8dd0f..c2b1c83b 100644 --- a/lib/src/vector_math/matrix3.dart +++ b/lib/src/vector_math/matrix3.dart @@ -556,11 +556,11 @@ class Matrix3 { final s = math.sin(radians); _m3storage[0] = c; _m3storage[1] = 0.0; - _m3storage[2] = -s; + _m3storage[2] = s; _m3storage[3] = 0.0; _m3storage[4] = 1.0; _m3storage[5] = 0.0; - _m3storage[6] = s; + _m3storage[6] = -s; _m3storage[7] = 0.0; _m3storage[8] = c; } diff --git a/lib/src/vector_math_64/matrix3.dart b/lib/src/vector_math_64/matrix3.dart index 89892d33..f497024b 100644 --- a/lib/src/vector_math_64/matrix3.dart +++ b/lib/src/vector_math_64/matrix3.dart @@ -556,11 +556,11 @@ class Matrix3 { final s = math.sin(radians); _m3storage[0] = c; _m3storage[1] = 0.0; - _m3storage[2] = -s; + _m3storage[2] = s; _m3storage[3] = 0.0; _m3storage[4] = 1.0; _m3storage[5] = 0.0; - _m3storage[6] = s; + _m3storage[6] = -s; _m3storage[7] = 0.0; _m3storage[8] = c; } diff --git a/test/matrix3_test.dart b/test/matrix3_test.dart index 4e0c3c9e..933c4a0b 100644 --- a/test/matrix3_test.dart +++ b/test/matrix3_test.dart @@ -194,32 +194,11 @@ void testMatrix3Transform() { relativeTest(rotX.transformed(input), input); relativeTest(rotY.transformed(input), - Vector3(1.0 / math.sqrt(2.0), 0.0, -1.0 / math.sqrt(2.0))); + Vector3(1.0 / math.sqrt(2.0), 0.0, 1.0 / math.sqrt(2.0))); relativeTest(rotZ.transformed(input), Vector3(1.0 / math.sqrt(2.0), 1.0 / math.sqrt(2.0), 0.0)); } -void testMatrix3RotationX() { - final rotX = Matrix3.rotationX(math.pi / 2); - final input = Vector3(0.0, 1.0, 0.0); - - relativeTest(rotX.transformed(input), Vector3(0.0, 0.0, 1.0)); -} - -void testMatrix3RotationY() { - final rotY = Matrix3.rotationY(math.pi / 2); - final input = Vector3(0.0, 0.0, 1.0); - - relativeTest(rotY.transformed(input), Vector3(1.0, 0.0, 0.0)); -} - -void testMatrix3RotationZ() { - final rotZ = Matrix3.rotationZ(math.pi / 2); - final input = Vector3(1.0, 0.0, 0.0); - - relativeTest(rotZ.transformed(input), Vector3(0.0, 1.0, 0.0)); -} - void testMatrix3Transform2() { final rotZ = Matrix3.rotationZ(math.pi / 4); final trans = Matrix3(1.0, 0.0, 3.0, 0.0, 1.0, 2.0, 3.0, 2.0, 1.0); @@ -355,9 +334,6 @@ void main() { test('transform 2D', testMatrix3Transform2); test('rotation 2D', testMatrix3AbsoluteRotate2); test('transform', testMatrix3Transform); - test('rotation 3D x', testMatrix3RotationX); - test('rotation 3D y', testMatrix3RotationY); - test('rotation 3D z', testMatrix3RotationZ); test('constructor', testMatrix3ConstructorCopy); test('inversion', testMatrix3Inversion); test('dot product', testMatrix3Dot);