diff options
author | bonmas14 <bonmas14@gmail.com> | 2023-10-25 01:02:43 +0300 |
---|---|---|
committer | bonmas14 <bonmas14@gmail.com> | 2023-10-25 01:02:43 +0300 |
commit | 91d37e2f17ca0e3d9f122c54268356edb1fd2978 (patch) | |
tree | add7808eddbade49232f20bafae9b071444c3924 | |
parent | e74eed094b929852187dd33bd35b9252f346a274 (diff) | |
download | RayRoom-91d37e2f17ca0e3d9f122c54268356edb1fd2978.tar.gz RayRoom-91d37e2f17ca0e3d9f122c54268356edb1fd2978.zip |
full left-to-right order in matrix x vector multiplication
-rw-r--r-- | AudioTester/Program.cs | 4 | ||||
-rw-r--r-- | RayRoom/Core/Matrix2x2.cs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/AudioTester/Program.cs b/AudioTester/Program.cs index 7557142..14212af 100644 --- a/AudioTester/Program.cs +++ b/AudioTester/Program.cs @@ -28,8 +28,8 @@ namespace AudioTester for (int i = 0; i < array.Length; i++) { - g.DrawLine(background, (mat * array[i].a + new Vector2(1000, 1000)).GetPoint(), (mat * array[i].b + new Vector2(1000, 1000)).GetPoint()); - g.DrawLine(foreground, (mat * array[i].a + new Vector2(1000, 1000)).GetPoint(), (mat * array[i].b + new Vector2(1000, 1000)).GetPoint()); + g.DrawLine(background, (array[i].a * mat + new Vector2(1000, 1000)).GetPoint(), (array[i].b * mat + new Vector2(1000, 1000)).GetPoint()); + g.DrawLine(foreground, (array[i].a * mat + new Vector2(1000, 1000)).GetPoint(), (array[i].b * mat + new Vector2(1000, 1000)).GetPoint()); } } diff --git a/RayRoom/Core/Matrix2x2.cs b/RayRoom/Core/Matrix2x2.cs index 4a5639a..d2ef642 100644 --- a/RayRoom/Core/Matrix2x2.cs +++ b/RayRoom/Core/Matrix2x2.cs @@ -26,14 +26,14 @@ namespace AudioTester public readonly float Determinant => (a*d) - (b*c); - public static Vector2 operator*(Matrix2x2 matrix, Vector2 vector) + public static Vector2 operator*(Vector2 vector, Matrix2x2 matrix) { return new Vector2(matrix.a, matrix.c) * vector.X + new Vector2(matrix.b, matrix.d) * vector.Y; } public static Matrix2x2 operator*(Matrix2x2 a, Matrix2x2 b) { - return new Matrix2x2(b * new Vector2(a.a, a.c), b * new Vector2(a.b, a.d)); + return new Matrix2x2(new Vector2(a.a, a.c) * b, new Vector2(a.b, a.d) * b); } } }
\ No newline at end of file |