diff options
Diffstat (limited to 'src/vector.rs')
-rw-r--r-- | src/vector.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/vector.rs b/src/vector.rs index d4e57cc..c4ddaab 100644 --- a/src/vector.rs +++ b/src/vector.rs @@ -58,6 +58,13 @@ impl ops::Div<f32> for Vector { } } +impl ops::Mul<Vector> for Vector { + type Output = f32; + fn mul(self, rhs: Vector) -> Self::Output { + self.x * rhs.x + self.y * rhs.y + self.z * rhs.z + } +} + impl Vector { pub fn magnitude_squared(self) -> f32 { self.x * self.x + self.y * self.y + self.z * self.z |