from rotation accept generic fixnum

This commit is contained in:
Corwin 2022-10-08 18:07:29 +01:00
parent 99f01caea4
commit d83f0ea710

View file

@ -34,7 +34,8 @@ impl AffineMatrix {
}
#[must_use]
pub fn from_rotation(angle: Num<i32, 16>) -> Self {
pub fn from_rotation<const N: usize>(angle: Num<i32, N>) -> Self {
fn from_rotation(angle: Num<i32, 28>) -> AffineMatrix {
let cos = angle.cos().change_base();
let sin = angle.sin().change_base();
@ -47,6 +48,8 @@ impl AffineMatrix {
y: 0.into(),
}
}
from_rotation(angle.rem_euclid(1.into()).change_base())
}
// Identity for rotation / scale / skew
#[must_use]
@ -167,7 +170,7 @@ mod tests {
assert_eq!(c.position(), position);
let d = AffineMatrix::from_rotation(num!(0.5));
let d = AffineMatrix::from_rotation::<2>(num!(0.5));
let e = a * d;