mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
from rotation accept generic fixnum
This commit is contained in:
parent
99f01caea4
commit
d83f0ea710
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue