This may be a general Rust question, but if I have:
pub struct Shape {
pub transform: Affine3<f32>
...
}
let mut s = Shape::new();
s.transform = nalgebra::convert(Similarity3::from_scaling(2.0));
s.transform = nalgebra::convert(Translation3::new(2.0,3.0,4.0));
how can I write a set_transform
function that takes either Similarity3
or Translation3
or another type of affine transform? I presume there is a trait which defines the relationship between the different transforms, but I can’t quite find it:
pub fn set_transform<W>(&self, t:W)
where W:SubTCategoryOf<TAffine> { /* Apparently not this */
self.transform = nalgebra::convert(t);
}
I’d rather not have to store a Matrix4
.