diff --git a/src/vector.rs b/src/vector.rs index 606f5ed..a6ef745 100644 --- a/src/vector.rs +++ b/src/vector.rs @@ -560,8 +560,10 @@ pub trait EuclideanVector: Vector + Sized where Float::sqrt(self.magnitude2()) } - /// The angle between the vector and `other`, in radians. - fn angle(self, other: Self) -> Rad; + /// Returns the angle between two vectors in radians. + fn angle(self, other: Self) -> Rad { + Rad::acos(Self::dot(self, other) / (self.magnitude() * other.magnitude())) + } /// Returns a vector with the same direction, but with a magnitude of `1`. #[inline] @@ -623,11 +625,6 @@ impl EuclideanVector for Vector4 { fn dot(self, other: Vector4) -> S { Vector4::mul_element_wise(self, other).sum() } - - #[inline] - fn angle(self, other: Vector4) -> Rad { - Rad::acos(Self::dot(self, other) / (self.magnitude() * other.magnitude())) - } } impl fmt::Debug for Vector2 {