After deadline commit

This commit is contained in:
Thomas Forgione
2018-04-10 13:37:08 +02:00
parent e508e01359
commit 5cc6196523
4 changed files with 33 additions and 20 deletions
+7
View File
@@ -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(),