manifold3d_types/math/
matrix4x3.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use crate::math;

#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Matrix4x3 {
    pub rows: [math::Vec3; 4],
}

impl Matrix4x3 {
    pub fn new(rows: [math::Vec3; 4]) -> Self {
        Self { rows }
    }
}

#[cfg(feature = "nalgebra_interop")]
impl From<nalgebra::Matrix4x3<f64>> for Matrix4x3 {
    fn from(matrix: nalgebra::Matrix4x3<f64>) -> Self {
        Matrix4x3 {
            rows: [
                math::Vec3 {
                    x: matrix.m11,
                    y: matrix.m12,
                    z: matrix.m13,
                },
                math::Vec3 {
                    x: matrix.m21,
                    y: matrix.m22,
                    z: matrix.m23,
                },
                math::Vec3 {
                    x: matrix.m31,
                    y: matrix.m32,
                    z: matrix.m33,
                },
                math::Vec3 {
                    x: matrix.m41,
                    y: matrix.m42,
                    z: matrix.m43,
                },
            ],
        }
    }
}