aboutsummaryrefslogtreecommitdiff
path: root/src/core/vector3.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/vector3.rs')
-rw-r--r--src/core/vector3.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/vector3.rs b/src/core/vector3.rs
index 1cc6f60..9ba0191 100644
--- a/src/core/vector3.rs
+++ b/src/core/vector3.rs
@@ -2,7 +2,7 @@
//!
//! Also add more 3d math things needed for shading and 3d calculations.
use crate::{Float, Number, NEAR_ZERO};
-use std::ops::{Mul, Sub, Add, DivAssign, Neg, AddAssign, Index};
+use std::ops::{Mul, Sub, Add, Div, DivAssign, Neg, AddAssign, Index};
use std::fmt;
#[derive(Clone, Copy)]
@@ -73,6 +73,17 @@ impl<T: Number> Mul<T> for Vector3<T> {
}
}
+impl<T: Number> Div<T> for Vector3<T> {
+ type Output = Self;
+ fn div(self, op: T) -> Self::Output {
+ Self::Output::new_xyz(
+ self.x / op,
+ self.y / op,
+ self.z / op,
+ )
+ }
+}
+
impl<T: Number> Neg for Vector3<T> {
type Output = Self;