mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-27 01:26:36 +11:00
add type for making unit vector from angle
This commit is contained in:
parent
1ac9e54296
commit
301a22d93a
1 changed files with 9 additions and 0 deletions
|
@ -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>> {
|
impl<I: FixedWidthUnsignedInteger, const N: usize> From<Vector2D<I>> for Vector2D<Num<I, N>> {
|
||||||
fn from(n: Vector2D<I>) -> Self {
|
fn from(n: Vector2D<I>) -> Self {
|
||||||
Vector2D {
|
Vector2D {
|
||||||
|
|
Loading…
Add table
Reference in a new issue