aboutsummaryrefslogtreecommitdiff
path: root/src/core/vector3.rs
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-08-04 17:21:03 +0200
committerJulian T <julian@jtle.dk>2021-08-04 17:21:03 +0200
commit02fedfc9653cb37219849de7dae14ae13d2f6c36 (patch)
treed76c804f6fcd1d8c9aa036251843198bf78eadd2 /src/core/vector3.rs
parent351d9132c0b2c54dfa9f50bfe328d25ccf059cea (diff)
Add translation and move center position from sphere
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;