mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-11 09:31:34 +11:00
add type for making unit vector from angle
This commit is contained in:
parent
1ac9e54296
commit
301a22d93a
|
@ -540,6 +540,15 @@ impl<T: Number> Vector2D<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<I: FixedWidthSignedInteger, const N: usize> Vector2D<Num<I, N>> {
|
||||
pub fn new_from_angle(angle: Num<I, N>) -> Self {
|
||||
Vector2D {
|
||||
x: angle.cos(),
|
||||
y: angle.sin(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<I: FixedWidthUnsignedInteger, const N: usize> From<Vector2D<I>> for Vector2D<Num<I, N>> {
|
||||
fn from(n: Vector2D<I>) -> Self {
|
||||
Vector2D {
|
||||
|
|
Loading…
Reference in a new issue