impl Into<glam::Mat4> for Planar64Affine3

This commit is contained in:
Quaternions 2024-09-16 15:02:03 -07:00
parent 8bccc2fe66
commit af1939a576

View File

@ -525,6 +525,19 @@ impl Planar64Affine3{
self.translation.fix_2()+self.matrix3*point
}
}
impl Into<glam::Mat4> for Planar64Affine3{
#[inline]
fn into(self)->glam::Mat4{
let matrix3=self.matrix3.to_array().map(|row|row.map(Into::<f32>::into));
let translation=self.translation.to_array().map(Into::<f32>::into);
glam::Mat4::from_cols_array(&[
matrix3[0][0],matrix3[0][1],matrix3[0][2],0.0,
matrix3[1][0],matrix3[1][1],matrix3[1][2],0.0,
matrix3[2][0],matrix3[2][1],matrix3[2][2],0.0,
translation[0],translation[1],translation[2],1.0
])
}
}
#[test]
fn test_sqrt(){