use crate::prelude::*;

#[derive(Debug, Clone, Copy)]
pub struct Mat3 {
    v: [Dir3; 3],
}

impl Mat3 {
    pub fn new(v: [Dir3; 3]) -> Self {
        Self { v }
    }

    pub fn transform(&self, dir: Dir3) -> Dir3 {
        self.v[0] * dir.x + self.v[1] * dir.y + self.v[2] * dir.z
    }

    pub fn transform_transposed(&self, dir: Dir3) -> Dir3 {
        Dir3::new(
            Dir3::dot(self.v[0], dir),
            Dir3::dot(self.v[1], dir),
            Dir3::dot(self.v[2], dir),
        )
    }
}
