summaryrefslogtreecommitdiff
path: root/engine/src/data_types
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/data_types')
-rw-r--r--engine/src/data_types/matrix.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/engine/src/data_types/matrix.rs b/engine/src/data_types/matrix.rs
index b480c35..ef263a1 100644
--- a/engine/src/data_types/matrix.rs
+++ b/engine/src/data_types/matrix.rs
@@ -39,6 +39,15 @@ impl<Value, const ROWS: usize, const COLUMNS: usize> Matrix<Value, ROWS, COLUMNS
Self { items }
}
+ pub fn from_rows<Row>(rows: [Row; ROWS]) -> Self
+ where
+ Row: Into<[Value; COLUMNS]>,
+ {
+ let items = rows.map(|row| row.into());
+
+ Self { items }
+ }
+
pub fn get_column_copied(&self, column_index: usize) -> [Value; ROWS]
where
Value: Default + Copy,