forked from StrafesNET/strafe-project
21 lines
421 B
Rust
21 lines
421 B
Rust
use std::ops::Add;
|
|
use fixed_wide_traits::wide::WideDot;
|
|
|
|
//TODO: replace this with 4x3 matrix
|
|
// mat4x3.wide_dot(vec3.extend(1))
|
|
|
|
pub struct Affine<M,T>{
|
|
pub matrix:M,
|
|
pub offset:T,
|
|
}
|
|
|
|
impl<M:Copy,T:Copy> Affine<M,T>{
|
|
pub fn wide_transform<X>(&self,input:X)-><<M as WideDot<X>>::Output as Add<T>>::Output
|
|
where
|
|
M:WideDot<X>,
|
|
<M as WideDot<X>>::Output:Add<T>,
|
|
{
|
|
self.matrix.wide_dot(input)+self.offset
|
|
}
|
|
}
|