fromArray

This commit is contained in:
2026-09-02 15:39:27 -05:00
parent 7d7e19b0fc
commit f097284904

View File

@@ -39,12 +39,17 @@ pub fn Matrix(rows: comptime_int, cols: comptime_int, T: type) type {
fn array(self: Self) [self.rows]T {
return @bitCast(self.mat);
}
fn fromArray(a: [rows]T) Self {
return .{ .mat = @bitCast(a) };
}
};
pub const get = if (cols == 1) vector.get else @compileError("Not a vector");
pub const swizzle = if (cols == 1) vector.swizzle else @compileError("Not a vector");
pub const dot = if (cols == 1) vector.dot else @compileError("Not a vector");
pub const array = if (cols == 1) vector.array else @compileError("Not a vector");
pub const fromArray = if (cols == 1) vector.fromArray else @compileError("Not a vector");
pub fn splat(s: T) Self {
var result: Self = .{ .mat = undefined };