1impl super::F3lMatrix for glam::Vec3A {
2 type RowType = [f32; 1];
3
4 #[inline]
5 fn cols(&self) -> usize {
6 1
7 }
8
9 #[inline]
10 fn rows(&self) -> usize {
11 3
12 }
13
14 #[inline]
15 fn row(&self, r: usize) -> Self::RowType {
16 [self[r]]
17 }
18
19 #[inline]
20 fn get(&self, r: usize, _: usize) -> Option<f32> {
21 match r {
22 0 => Some(self.x),
23 1 => Some(self.y),
24 2 => Some(self.z),
25 _ => None,
26 }
27 }
28
29 #[inline]
30 fn set_row<R: Into<Self::RowType> + Copy>(&mut self, row: usize, v: R) {
31 if row >= 1 {
32 return;
33 }
34 self[row] = v.into()[0];
35 }
36
37 #[inline]
38 fn set_element(&mut self, pos: (usize, usize), v: f32) {
39 if pos.1 >= 1 {
40 return;
41 }
42 self[pos.0] = v;
43 }
44}
45
46impl super::ArrayRowMajor for glam::Vec3A {
47 type Row = [f32; 3];
48
49 type Mat = [[f32; 1]; 3];
50
51 #[inline]
52 fn from_rows<R: std::ops::Index<usize, Output = f32>>(rows: &[R]) -> Self {
53 Self::new(rows[0][0], rows[0][1], rows[0][3])
54 }
55
56 #[inline]
57 fn from_rows_slice(m: &[f32]) -> Self {
58 Self::from_slice(m)
59 }
60
61 #[inline]
62 fn to_rows_array(&self) -> Self::Row {
63 (*self).into()
64 }
65
66 #[inline]
67 fn from_cols_array_2d(m: &Self::Mat) -> Self {
68 Self::new(m[0][0], m[1][0], m[2][0])
69 }
70
71 #[inline]
72 fn to_rows_array_2d(&self) -> Self::Mat {
73 [[self.x], [self.y], [self.z]]
74 }
75
76 #[inline]
77 fn write_rows_to_slice(self, slice: &mut [f32]) {
78 self.write_to_slice(slice)
79 }
80}
81
82impl super::ArrayDimensions for glam::Vec3A {
83 fn nb_cols() -> usize {
84 3
85 }
86
87 fn nb_rows() -> usize {
88 1
89 }
90}
91impl super::GenericArray for glam::Vec3A {}