Skip to content

Commit c367df8

Browse files
authored
Add Mat2::from_mat3_minor and Mat3::from_mat4_minor methods (#543)
Fixes #325
1 parent 0e98fbe commit c367df8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+984
-299
lines changed

codegen/templates/macros.rs.tera

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,69 @@
55
{%- endfor -%}
66
)
77
{% endmacro make_tuple_t %}
8+
9+
{% macro impl_mat3_minor(mat3_t, align="") %}
10+
/// Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the `i`th column
11+
/// and `j`th row.
12+
///
13+
/// # Panics
14+
///
15+
/// Panics if `i` or `j` is greater than 2.
16+
#[inline]
17+
#[must_use]
18+
pub fn from_mat3{{ align }}_minor(m: {{ mat3_t }}, i: usize, j: usize) -> Self {
19+
match (i, j) {
20+
(0, 0) => Self::from_cols(m.y_axis.yz(), m.z_axis.yz()),
21+
(0, 1) => Self::from_cols(m.y_axis.xz(), m.z_axis.xz()),
22+
(0, 2) => Self::from_cols(m.y_axis.xy(), m.z_axis.xy()),
23+
(1, 0) => Self::from_cols(m.x_axis.yz(), m.z_axis.yz()),
24+
(1, 1) => Self::from_cols(m.x_axis.xz(), m.z_axis.xz()),
25+
(1, 2) => Self::from_cols(m.x_axis.xy(), m.z_axis.xy()),
26+
(2, 0) => Self::from_cols(m.x_axis.yz(), m.y_axis.yz()),
27+
(2, 1) => Self::from_cols(m.x_axis.xz(), m.y_axis.xz()),
28+
(2, 2) => Self::from_cols(m.x_axis.xy(), m.y_axis.xy()),
29+
_ => panic!("index out of bounds"),
30+
}
31+
}
32+
{% endmacro impl_mat3_minor %}
33+
34+
{% macro impl_mat4_minor(mat4_t, vec3_t) %}
35+
{% if vec3_t == "Vec3A" %}
36+
{% set w = "w" %}
37+
{% set b = "Vec3A::from_vec4(" %}
38+
{% set e = ")" %}
39+
{% else %}
40+
{% set w = "" %}
41+
{% set b = "" %}
42+
{% set e = "" %}
43+
{% endif %}
44+
/// Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the `i`th column
45+
/// and `j`th row.
46+
///
47+
/// # Panics
48+
///
49+
/// Panics if `i` or `j` is greater than 3.
50+
#[inline]
51+
#[must_use]
52+
pub fn from_mat4_minor(m: {{ mat4_t }}, i: usize, j: usize) -> Self {
53+
match (i, j) {
54+
(0, 0) => Self::from_cols({{ b }}m.y_axis.yzw{{ w }}(){{ e }}, {{ b }}m.z_axis.yzw{{ w }}(){{ e }}, {{ b }}m.w_axis.yzw{{ w }}(){{ e }}),
55+
(0, 1) => Self::from_cols({{ b }}m.y_axis.xzw{{ w }}(){{ e }}, {{ b }}m.z_axis.xzw{{ w }}(){{ e }}, {{ b }}m.w_axis.xzw{{ w }}(){{ e }}),
56+
(0, 2) => Self::from_cols({{ b }}m.y_axis.xyw{{ w }}(){{ e }}, {{ b }}m.z_axis.xyw{{ w }}(){{ e }}, {{ b }}m.w_axis.xyw{{ w }}(){{ e }}),
57+
(0, 3) => Self::from_cols({{ b }}m.y_axis.xyz{{ w }}(){{ e }}, {{ b }}m.z_axis.xyz{{ w }}(){{ e }}, {{ b }}m.w_axis.xyz{{ w }}(){{ e }}),
58+
(1, 0) => Self::from_cols({{ b }}m.x_axis.yzw{{ w }}(){{ e }}, {{ b }}m.z_axis.yzw{{ w }}(){{ e }}, {{ b }}m.w_axis.yzw{{ w }}(){{ e }}),
59+
(1, 1) => Self::from_cols({{ b }}m.x_axis.xzw{{ w }}(){{ e }}, {{ b }}m.z_axis.xzw{{ w }}(){{ e }}, {{ b }}m.w_axis.xzw{{ w }}(){{ e }}),
60+
(1, 2) => Self::from_cols({{ b }}m.x_axis.xyw{{ w }}(){{ e }}, {{ b }}m.z_axis.xyw{{ w }}(){{ e }}, {{ b }}m.w_axis.xyw{{ w }}(){{ e }}),
61+
(1, 3) => Self::from_cols({{ b }}m.x_axis.xyz{{ w }}(){{ e }}, {{ b }}m.z_axis.xyz{{ w }}(){{ e }}, {{ b }}m.w_axis.xyz{{ w }}(){{ e }}),
62+
(2, 0) => Self::from_cols({{ b }}m.x_axis.yzw{{ w }}(){{ e }}, {{ b }}m.y_axis.yzw{{ w }}(){{ e }}, {{ b }}m.w_axis.yzw{{ w }}(){{ e }}),
63+
(2, 1) => Self::from_cols({{ b }}m.x_axis.xzw{{ w }}(){{ e }}, {{ b }}m.y_axis.xzw{{ w }}(){{ e }}, {{ b }}m.w_axis.xzw{{ w }}(){{ e }}),
64+
(2, 2) => Self::from_cols({{ b }}m.x_axis.xyw{{ w }}(){{ e }}, {{ b }}m.y_axis.xyw{{ w }}(){{ e }}, {{ b }}m.w_axis.xyw{{ w }}(){{ e }}),
65+
(2, 3) => Self::from_cols({{ b }}m.x_axis.xyz{{ w }}(){{ e }}, {{ b }}m.y_axis.xyz{{ w }}(){{ e }}, {{ b }}m.w_axis.xyz{{ w }}(){{ e }}),
66+
(3, 0) => Self::from_cols({{ b }}m.x_axis.yzw{{ w }}(){{ e }}, {{ b }}m.y_axis.yzw{{ w }}(){{ e }}, {{ b }}m.z_axis.yzw{{ w }}(){{ e }}),
67+
(3, 1) => Self::from_cols({{ b }}m.x_axis.xzw{{ w }}(){{ e }}, {{ b }}m.y_axis.xzw{{ w }}(){{ e }}, {{ b }}m.z_axis.xzw{{ w }}(){{ e }}),
68+
(3, 2) => Self::from_cols({{ b }}m.x_axis.xyw{{ w }}(){{ e }}, {{ b }}m.y_axis.xyw{{ w }}(){{ e }}, {{ b }}m.z_axis.xyw{{ w }}(){{ e }}),
69+
(3, 3) => Self::from_cols({{ b }}m.x_axis.xyz{{ w }}(){{ e }}, {{ b }}m.y_axis.xyz{{ w }}(){{ e }}, {{ b }}m.z_axis.xyz{{ w }}(){{ e }}),
70+
_ => panic!("index out of bounds"),
71+
}
72+
}
73+
{% endmacro impl_mat4_minor %}

codegen/templates/mat.rs.tera

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{% import "macros.rs.tera" as macros %}
12
{% import "coresimd.rs.tera" as coresimd %}
23
{% import "neon.rs.tera" as neon %}
34
{% import "sse2.rs.tera" as sse2 %}
@@ -437,6 +438,8 @@ impl {{ self_t }} {
437438
Self::from_cols(m.x_axis.xy(), m.y_axis.xy())
438439
}
439440

441+
{{ macros::impl_mat3_minor(mat3_t=mat3_t) }}
442+
440443
{% if scalar_t == "f32" %}
441444
/// Creates a {{ nxn }} matrix from a 3x3 matrix, discarding the 2nd row and column.
442445
#[inline]
@@ -445,6 +448,8 @@ impl {{ self_t }} {
445448
{# TODO: SIMD optimise #}
446449
Self::from_cols(m.x_axis.xy(), m.y_axis.xy())
447450
}
451+
452+
{{ macros::impl_mat3_minor(mat3_t="Mat3A", align="a") }}
448453
{% endif %}
449454

450455
{% elif dim == 3 %}
@@ -459,6 +464,8 @@ impl {{ self_t }} {
459464
)
460465
}
461466

467+
{{ macros::impl_mat4_minor(mat4_t=mat4_t, vec3_t=col_t) }}
468+
462469
/// Creates a 3D rotation matrix from the given quaternion.
463470
///
464471
/// # Panics

codegen/templates/swizzle_impl.rs.tera

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl Vec{{ dim }}Swizzles for {{ self_t }} {
5353
{% for j0 in indices | slice(end=dim) %}
5454
{% for j1 in indices | slice(end=dim) %}
5555
{% if i == 2 %}
56-
{% set skip = dim == 2 and j0 == "x" and j1 == "y" %}
56+
{% set skip = dim == 2 and j0 == 0 and j1 == 1 %}
5757
{% if not skip %}
5858
#[inline]
5959
#[must_use]
@@ -64,7 +64,7 @@ impl Vec{{ dim }}Swizzles for {{ self_t }} {
6464
{% else %}
6565
{% for j2 in indices | slice(end=dim) %}
6666
{% if i == 3 %}
67-
{% set skip = dim == 3 and j0 == "x" and j1 == "y" and j2 == "z" %}
67+
{% set skip = dim == 3 and j0 == 0 and j1 == 1 and j2 == 2 %}
6868
{% if not skip %}
6969
#[inline]
7070
#[must_use]
@@ -82,7 +82,7 @@ impl Vec{{ dim }}Swizzles for {{ self_t }} {
8282
{% endif %}
8383
{% else %}
8484
{% for j3 in indices | slice(end=dim) %}
85-
{% set skip = dim == 4 and j0 == "x" and j1 == "y" and j2 == "z" and j3 == "w" %}
85+
{% set skip = dim == 4 and j0 == 0 and j1 == 1 and j2 == 2 and j3 == 3 %}
8686
{% if not skip %}
8787
#[inline]
8888
#[must_use]

src/f32/coresimd/mat2.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,59 @@ impl Mat2 {
114114
Self::from_cols(m.x_axis.xy(), m.y_axis.xy())
115115
}
116116

117+
/// Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the `i`th column
118+
/// and `j`th row.
119+
///
120+
/// # Panics
121+
///
122+
/// Panics if `i` or `j` is greater than 2.
123+
#[inline]
124+
#[must_use]
125+
pub fn from_mat3_minor(m: Mat3, i: usize, j: usize) -> Self {
126+
match (i, j) {
127+
(0, 0) => Self::from_cols(m.y_axis.yz(), m.z_axis.yz()),
128+
(0, 1) => Self::from_cols(m.y_axis.xz(), m.z_axis.xz()),
129+
(0, 2) => Self::from_cols(m.y_axis.xy(), m.z_axis.xy()),
130+
(1, 0) => Self::from_cols(m.x_axis.yz(), m.z_axis.yz()),
131+
(1, 1) => Self::from_cols(m.x_axis.xz(), m.z_axis.xz()),
132+
(1, 2) => Self::from_cols(m.x_axis.xy(), m.z_axis.xy()),
133+
(2, 0) => Self::from_cols(m.x_axis.yz(), m.y_axis.yz()),
134+
(2, 1) => Self::from_cols(m.x_axis.xz(), m.y_axis.xz()),
135+
(2, 2) => Self::from_cols(m.x_axis.xy(), m.y_axis.xy()),
136+
_ => panic!("index out of bounds"),
137+
}
138+
}
139+
117140
/// Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column.
118141
#[inline]
119142
#[must_use]
120143
pub fn from_mat3a(m: Mat3A) -> Self {
121144
Self::from_cols(m.x_axis.xy(), m.y_axis.xy())
122145
}
123146

147+
/// Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the `i`th column
148+
/// and `j`th row.
149+
///
150+
/// # Panics
151+
///
152+
/// Panics if `i` or `j` is greater than 2.
153+
#[inline]
154+
#[must_use]
155+
pub fn from_mat3a_minor(m: Mat3A, i: usize, j: usize) -> Self {
156+
match (i, j) {
157+
(0, 0) => Self::from_cols(m.y_axis.yz(), m.z_axis.yz()),
158+
(0, 1) => Self::from_cols(m.y_axis.xz(), m.z_axis.xz()),
159+
(0, 2) => Self::from_cols(m.y_axis.xy(), m.z_axis.xy()),
160+
(1, 0) => Self::from_cols(m.x_axis.yz(), m.z_axis.yz()),
161+
(1, 1) => Self::from_cols(m.x_axis.xz(), m.z_axis.xz()),
162+
(1, 2) => Self::from_cols(m.x_axis.xy(), m.z_axis.xy()),
163+
(2, 0) => Self::from_cols(m.x_axis.yz(), m.y_axis.yz()),
164+
(2, 1) => Self::from_cols(m.x_axis.xz(), m.y_axis.xz()),
165+
(2, 2) => Self::from_cols(m.x_axis.xy(), m.y_axis.xy()),
166+
_ => panic!("index out of bounds"),
167+
}
168+
}
169+
124170
/// Creates a 2x2 matrix from the first 4 values in `slice`.
125171
///
126172
/// # Panics

src/f32/coresimd/mat3a.rs

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,100 @@ impl Mat3A {
164164
)
165165
}
166166

167+
/// Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the `i`th column
168+
/// and `j`th row.
169+
///
170+
/// # Panics
171+
///
172+
/// Panics if `i` or `j` is greater than 3.
173+
#[inline]
174+
#[must_use]
175+
pub fn from_mat4_minor(m: Mat4, i: usize, j: usize) -> Self {
176+
match (i, j) {
177+
(0, 0) => Self::from_cols(
178+
Vec3A::from_vec4(m.y_axis.yzww()),
179+
Vec3A::from_vec4(m.z_axis.yzww()),
180+
Vec3A::from_vec4(m.w_axis.yzww()),
181+
),
182+
(0, 1) => Self::from_cols(
183+
Vec3A::from_vec4(m.y_axis.xzww()),
184+
Vec3A::from_vec4(m.z_axis.xzww()),
185+
Vec3A::from_vec4(m.w_axis.xzww()),
186+
),
187+
(0, 2) => Self::from_cols(
188+
Vec3A::from_vec4(m.y_axis.xyww()),
189+
Vec3A::from_vec4(m.z_axis.xyww()),
190+
Vec3A::from_vec4(m.w_axis.xyww()),
191+
),
192+
(0, 3) => Self::from_cols(
193+
Vec3A::from_vec4(m.y_axis.xyzw()),
194+
Vec3A::from_vec4(m.z_axis.xyzw()),
195+
Vec3A::from_vec4(m.w_axis.xyzw()),
196+
),
197+
(1, 0) => Self::from_cols(
198+
Vec3A::from_vec4(m.x_axis.yzww()),
199+
Vec3A::from_vec4(m.z_axis.yzww()),
200+
Vec3A::from_vec4(m.w_axis.yzww()),
201+
),
202+
(1, 1) => Self::from_cols(
203+
Vec3A::from_vec4(m.x_axis.xzww()),
204+
Vec3A::from_vec4(m.z_axis.xzww()),
205+
Vec3A::from_vec4(m.w_axis.xzww()),
206+
),
207+
(1, 2) => Self::from_cols(
208+
Vec3A::from_vec4(m.x_axis.xyww()),
209+
Vec3A::from_vec4(m.z_axis.xyww()),
210+
Vec3A::from_vec4(m.w_axis.xyww()),
211+
),
212+
(1, 3) => Self::from_cols(
213+
Vec3A::from_vec4(m.x_axis.xyzw()),
214+
Vec3A::from_vec4(m.z_axis.xyzw()),
215+
Vec3A::from_vec4(m.w_axis.xyzw()),
216+
),
217+
(2, 0) => Self::from_cols(
218+
Vec3A::from_vec4(m.x_axis.yzww()),
219+
Vec3A::from_vec4(m.y_axis.yzww()),
220+
Vec3A::from_vec4(m.w_axis.yzww()),
221+
),
222+
(2, 1) => Self::from_cols(
223+
Vec3A::from_vec4(m.x_axis.xzww()),
224+
Vec3A::from_vec4(m.y_axis.xzww()),
225+
Vec3A::from_vec4(m.w_axis.xzww()),
226+
),
227+
(2, 2) => Self::from_cols(
228+
Vec3A::from_vec4(m.x_axis.xyww()),
229+
Vec3A::from_vec4(m.y_axis.xyww()),
230+
Vec3A::from_vec4(m.w_axis.xyww()),
231+
),
232+
(2, 3) => Self::from_cols(
233+
Vec3A::from_vec4(m.x_axis.xyzw()),
234+
Vec3A::from_vec4(m.y_axis.xyzw()),
235+
Vec3A::from_vec4(m.w_axis.xyzw()),
236+
),
237+
(3, 0) => Self::from_cols(
238+
Vec3A::from_vec4(m.x_axis.yzww()),
239+
Vec3A::from_vec4(m.y_axis.yzww()),
240+
Vec3A::from_vec4(m.z_axis.yzww()),
241+
),
242+
(3, 1) => Self::from_cols(
243+
Vec3A::from_vec4(m.x_axis.xzww()),
244+
Vec3A::from_vec4(m.y_axis.xzww()),
245+
Vec3A::from_vec4(m.z_axis.xzww()),
246+
),
247+
(3, 2) => Self::from_cols(
248+
Vec3A::from_vec4(m.x_axis.xyww()),
249+
Vec3A::from_vec4(m.y_axis.xyww()),
250+
Vec3A::from_vec4(m.z_axis.xyww()),
251+
),
252+
(3, 3) => Self::from_cols(
253+
Vec3A::from_vec4(m.x_axis.xyzw()),
254+
Vec3A::from_vec4(m.y_axis.xyzw()),
255+
Vec3A::from_vec4(m.z_axis.xyzw()),
256+
),
257+
_ => panic!("index out of bounds"),
258+
}
259+
}
260+
167261
/// Creates a 3D rotation matrix from the given quaternion.
168262
///
169263
/// # Panics

src/f32/mat3.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,36 @@ impl Mat3 {
165165
)
166166
}
167167

168+
/// Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the `i`th column
169+
/// and `j`th row.
170+
///
171+
/// # Panics
172+
///
173+
/// Panics if `i` or `j` is greater than 3.
174+
#[inline]
175+
#[must_use]
176+
pub fn from_mat4_minor(m: Mat4, i: usize, j: usize) -> Self {
177+
match (i, j) {
178+
(0, 0) => Self::from_cols(m.y_axis.yzw(), m.z_axis.yzw(), m.w_axis.yzw()),
179+
(0, 1) => Self::from_cols(m.y_axis.xzw(), m.z_axis.xzw(), m.w_axis.xzw()),
180+
(0, 2) => Self::from_cols(m.y_axis.xyw(), m.z_axis.xyw(), m.w_axis.xyw()),
181+
(0, 3) => Self::from_cols(m.y_axis.xyz(), m.z_axis.xyz(), m.w_axis.xyz()),
182+
(1, 0) => Self::from_cols(m.x_axis.yzw(), m.z_axis.yzw(), m.w_axis.yzw()),
183+
(1, 1) => Self::from_cols(m.x_axis.xzw(), m.z_axis.xzw(), m.w_axis.xzw()),
184+
(1, 2) => Self::from_cols(m.x_axis.xyw(), m.z_axis.xyw(), m.w_axis.xyw()),
185+
(1, 3) => Self::from_cols(m.x_axis.xyz(), m.z_axis.xyz(), m.w_axis.xyz()),
186+
(2, 0) => Self::from_cols(m.x_axis.yzw(), m.y_axis.yzw(), m.w_axis.yzw()),
187+
(2, 1) => Self::from_cols(m.x_axis.xzw(), m.y_axis.xzw(), m.w_axis.xzw()),
188+
(2, 2) => Self::from_cols(m.x_axis.xyw(), m.y_axis.xyw(), m.w_axis.xyw()),
189+
(2, 3) => Self::from_cols(m.x_axis.xyz(), m.y_axis.xyz(), m.w_axis.xyz()),
190+
(3, 0) => Self::from_cols(m.x_axis.yzw(), m.y_axis.yzw(), m.z_axis.yzw()),
191+
(3, 1) => Self::from_cols(m.x_axis.xzw(), m.y_axis.xzw(), m.z_axis.xzw()),
192+
(3, 2) => Self::from_cols(m.x_axis.xyw(), m.y_axis.xyw(), m.z_axis.xyw()),
193+
(3, 3) => Self::from_cols(m.x_axis.xyz(), m.y_axis.xyz(), m.z_axis.xyz()),
194+
_ => panic!("index out of bounds"),
195+
}
196+
}
197+
168198
/// Creates a 3D rotation matrix from the given quaternion.
169199
///
170200
/// # Panics

src/f32/neon/mat2.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,59 @@ impl Mat2 {
130130
Self::from_cols(m.x_axis.xy(), m.y_axis.xy())
131131
}
132132

133+
/// Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the `i`th column
134+
/// and `j`th row.
135+
///
136+
/// # Panics
137+
///
138+
/// Panics if `i` or `j` is greater than 2.
139+
#[inline]
140+
#[must_use]
141+
pub fn from_mat3_minor(m: Mat3, i: usize, j: usize) -> Self {
142+
match (i, j) {
143+
(0, 0) => Self::from_cols(m.y_axis.yz(), m.z_axis.yz()),
144+
(0, 1) => Self::from_cols(m.y_axis.xz(), m.z_axis.xz()),
145+
(0, 2) => Self::from_cols(m.y_axis.xy(), m.z_axis.xy()),
146+
(1, 0) => Self::from_cols(m.x_axis.yz(), m.z_axis.yz()),
147+
(1, 1) => Self::from_cols(m.x_axis.xz(), m.z_axis.xz()),
148+
(1, 2) => Self::from_cols(m.x_axis.xy(), m.z_axis.xy()),
149+
(2, 0) => Self::from_cols(m.x_axis.yz(), m.y_axis.yz()),
150+
(2, 1) => Self::from_cols(m.x_axis.xz(), m.y_axis.xz()),
151+
(2, 2) => Self::from_cols(m.x_axis.xy(), m.y_axis.xy()),
152+
_ => panic!("index out of bounds"),
153+
}
154+
}
155+
133156
/// Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column.
134157
#[inline]
135158
#[must_use]
136159
pub fn from_mat3a(m: Mat3A) -> Self {
137160
Self::from_cols(m.x_axis.xy(), m.y_axis.xy())
138161
}
139162

163+
/// Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the `i`th column
164+
/// and `j`th row.
165+
///
166+
/// # Panics
167+
///
168+
/// Panics if `i` or `j` is greater than 2.
169+
#[inline]
170+
#[must_use]
171+
pub fn from_mat3a_minor(m: Mat3A, i: usize, j: usize) -> Self {
172+
match (i, j) {
173+
(0, 0) => Self::from_cols(m.y_axis.yz(), m.z_axis.yz()),
174+
(0, 1) => Self::from_cols(m.y_axis.xz(), m.z_axis.xz()),
175+
(0, 2) => Self::from_cols(m.y_axis.xy(), m.z_axis.xy()),
176+
(1, 0) => Self::from_cols(m.x_axis.yz(), m.z_axis.yz()),
177+
(1, 1) => Self::from_cols(m.x_axis.xz(), m.z_axis.xz()),
178+
(1, 2) => Self::from_cols(m.x_axis.xy(), m.z_axis.xy()),
179+
(2, 0) => Self::from_cols(m.x_axis.yz(), m.y_axis.yz()),
180+
(2, 1) => Self::from_cols(m.x_axis.xz(), m.y_axis.xz()),
181+
(2, 2) => Self::from_cols(m.x_axis.xy(), m.y_axis.xy()),
182+
_ => panic!("index out of bounds"),
183+
}
184+
}
185+
140186
/// Creates a 2x2 matrix from the first 4 values in `slice`.
141187
///
142188
/// # Panics

0 commit comments

Comments
 (0)