Skip to main content

brep_kernel/io/
step_matrix.rs

1//! Matrix composition shared by STEP import and export.
2
3/// A row-major 4×4 matrix used for STEP assembly placements.
4pub type Mat4 = [f64; 16];
5
6pub(crate) const MAT4_IDENTITY: Mat4 = [
7    1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
8];
9
10pub(crate) fn mat4_mul(a: &Mat4, b: &Mat4) -> Mat4 {
11    let mut out = [0.0f64; 16];
12    for row in 0..4 {
13        for col in 0..4 {
14            let mut sum = 0.0;
15            for k in 0..4 {
16                sum += a[row * 4 + k] * b[k * 4 + col];
17            }
18            out[row * 4 + col] = sum;
19        }
20    }
21    out
22}
23
24// BREP private tests: 31738417e5ee3dde