After deadline commit
This commit is contained in:
@@ -112,6 +112,11 @@ macro_rules! make_vector {
|
||||
*self /= self.norm()
|
||||
}
|
||||
|
||||
/// Returns a new normalized vector.
|
||||
pub fn normalized(&self) -> $name<T> {
|
||||
*self / self.norm()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl<T: Number> Add for $name<T> {
|
||||
@@ -224,6 +229,7 @@ make_vector!(Vector3, 3, (T, T, T), (x, x_mut, 0), (y, y_mut, 1), (z, z_mut, 2))
|
||||
make_vector!(Vector4, 4, (T, T, T, T), (x, x_mut, 0), (y, y_mut, 1), (z, z_mut, 2), (t, t_mut, 3));
|
||||
|
||||
impl Vector2<f32> {
|
||||
/// Returns a orthogonal vector to the one passed as parameter.
|
||||
pub fn orthogonal(&self) -> Vector2<f32> {
|
||||
Vector2::new(
|
||||
self.y(),
|
||||
@@ -233,6 +239,7 @@ impl Vector2<f32> {
|
||||
}
|
||||
|
||||
impl Vector2<i32> {
|
||||
/// Returns a orthogonal vector to the one passed as parameter.
|
||||
pub fn orthogonal(&self) -> Vector2<i32> {
|
||||
Vector2::new(
|
||||
self.y(),
|
||||
|
||||
Reference in New Issue
Block a user