manifold3d_types/math/
matrix4x3.rs

1use crate::math;
2
3#[derive(Debug, Clone, Copy, PartialEq)]
4pub struct Matrix4x3 {
5    pub rows: [math::Vec3; 4],
6}
7
8impl Matrix4x3 {
9    pub fn new(rows: [math::Vec3; 4]) -> Self {
10        Self { rows }
11    }
12}
13
14#[cfg(feature = "nalgebra_interop")]
15impl From<nalgebra::Matrix4x3<f64>> for Matrix4x3 {
16    fn from(matrix: nalgebra::Matrix4x3<f64>) -> Self {
17        Matrix4x3 {
18            rows: [
19                math::Vec3 {
20                    x: matrix.m11,
21                    y: matrix.m12,
22                    z: matrix.m13,
23                },
24                math::Vec3 {
25                    x: matrix.m21,
26                    y: matrix.m22,
27                    z: matrix.m23,
28                },
29                math::Vec3 {
30                    x: matrix.m31,
31                    y: matrix.m32,
32                    z: matrix.m33,
33                },
34                math::Vec3 {
35                    x: matrix.m41,
36                    y: matrix.m42,
37                    z: matrix.m43,
38                },
39            ],
40        }
41    }
42}