math: zig fmt

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2023-10-13 19:27:20 -07:00
parent e1ce5c5662
commit c03673ff05
2 changed files with 11 additions and 22 deletions

View file

@ -371,7 +371,6 @@ pub fn Mat(
return vec.Vec(ColVec.n, ColVec.T){ .v = result }; return vec.Vec(ColVec.n, ColVec.T){ .v = result };
} }
// TODO: the below code was correct in our old implementation, it just needs to be updated // TODO: the below code was correct in our old implementation, it just needs to be updated
// to work with this new Mat approach, swapping f32 for the generic T float type, moving 3x3 // to work with this new Mat approach, swapping f32 for the generic T float type, moving 3x3
// and 4x4 specific functions into the mixin above, writing new tests, etc. // and 4x4 specific functions into the mixin above, writing new tests, etc.
@ -687,6 +686,3 @@ test "Mat4x4_mulVec_vec4" {
const expected = math.vec4(4, 47, 5, 68); const expected = math.vec4(4, 47, 5, 68);
try testing.expect(math.Vec4, expected).eql(m); try testing.expect(math.Vec4, expected).eql(m);
} }

View file

@ -80,11 +80,8 @@ pub fn Vec(comptime n_value: usize, comptime Scalar: type) type {
result[i] += vector.v[j] * matrix.v[i].v[j]; result[i] += vector.v[j] * matrix.v[i].v[j];
} }
} }
return .{ return .{ .v = result };
.v = result
};
} }
}, },
inline 4 => struct { inline 4 => struct {
pub inline fn init(xs: Scalar, ys: Scalar, zs: Scalar, ws: Scalar) VecN { pub inline fn init(xs: Scalar, ys: Scalar, zs: Scalar, ws: Scalar) VecN {
@ -111,9 +108,7 @@ pub fn Vec(comptime n_value: usize, comptime Scalar: type) type {
result[i] += vector.v[j] * matrix.v[i].v[j]; result[i] += vector.v[j] * matrix.v[i].v[j];
} }
} }
return .{ return .{ .v = result };
.v = result
};
} }
}, },
else => @compileError("Expected Vec2, Vec3, Vec4, found '" ++ @typeName(VecN) ++ "'"), else => @compileError("Expected Vec2, Vec3, Vec4, found '" ++ @typeName(VecN) ++ "'"),
@ -346,8 +341,6 @@ pub fn Vec(comptime n_value: usize, comptime Scalar: type) type {
return min_scalar; return min_scalar;
} }
}; };
} }