aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralaric <alaric@netmythos.org>2024-04-10 06:32:15 -0700
committeralaric <alaric@netmythos.org>2024-04-10 06:32:15 -0700
commit3215bdb14f88c53d68b6ed8348bafea36c7bebb9 (patch)
treef5529ef322f900872b080ee0cb302ee47168c58f
parentc89aa3b181e253f5980478ad4157912cd23fab72 (diff)
downloadengine-3215bdb14f88c53d68b6ed8348bafea36c7bebb9.tar.gz
engine-3215bdb14f88c53d68b6ed8348bafea36c7bebb9.zip
fix!:make matrix z rotation go clockwise instead of ccw
I yolo'd this by just swapping the signs and it seemed to work, but if there were suddenly weird issues with rotation, I would look here.
-rw-r--r--src/matrix.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/matrix.zig b/src/matrix.zig
index 355369e..8ce1dfc 100644
--- a/src/matrix.zig
+++ b/src/matrix.zig
@@ -81,12 +81,16 @@ pub fn Matrix(comptime T: type, row_count: usize, col_count: usize) type {
const s = @sin(angle);
var base = Self.identity;
base.data[0][0] = c;
- base.data[0][1] = -s;
- base.data[1][0] = s;
+ base.data[0][1] = s;
+ base.data[1][0] = -s;
base.data[1][1] = c;
return base;
}
+ pub fn rotateZ(self: Self, angle: T) Self {
+ return self.multiply(Self.zRotation(angle));
+ }
+
pub fn scaled(self: Self, vals: [@min(rows, cols) - 1]f32) Self {
return self.multiply(Self.scale(vals));
}