diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/bound.rs | 2 | ||||
-rw-r--r-- | src/core/vector2.rs | 2 | ||||
-rw-r--r-- | src/core/vector3.rs | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/core/bound.rs b/src/core/bound.rs index 404424e..3978028 100644 --- a/src/core/bound.rs +++ b/src/core/bound.rs @@ -83,7 +83,7 @@ impl<T: Number> Bound2<T> { /// ``` pub fn area(&self) -> T { let diag = self.diagonal(); - return diag.x * diag.y; + diag.x * diag.y } } diff --git a/src/core/vector2.rs b/src/core/vector2.rs index 0e0165e..405b12a 100644 --- a/src/core/vector2.rs +++ b/src/core/vector2.rs @@ -112,7 +112,7 @@ impl Vector2i { } impl Vector2f { - pub fn len(&self) -> Float { + pub fn length(&self) -> Float { (self.x*self.x + self.y*self.y).sqrt() } diff --git a/src/core/vector3.rs b/src/core/vector3.rs index 24b84e9..e26c07c 100644 --- a/src/core/vector3.rs +++ b/src/core/vector3.rs @@ -117,7 +117,7 @@ impl Vector3f { self.x * self.x + self.y * self.y + self.z * self.z } - pub fn len(&self) -> Float { + pub fn length(&self) -> Float { self.len_squared().sqrt() } @@ -137,7 +137,7 @@ impl Vector3f { /// ``` pub fn norm_in(&mut self) { // TODO Experiment with checking for normality with len_squared - let len = self.len(); + let len = self.length(); if len == 0.0 { *self = Self::new(0.0); } @@ -146,7 +146,7 @@ impl Vector3f { } pub fn norm(&self) -> Self { - let mut new = self.clone(); + let mut new = *self; new.norm_in(); new } |