From 02fedfc9653cb37219849de7dae14ae13d2f6c36 Mon Sep 17 00:00:00 2001 From: Julian T Date: Wed, 4 Aug 2021 17:21:03 +0200 Subject: Add translation and move center position from sphere --- src/core/vector3.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/core/vector3.rs') 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 Mul for Vector3 { } } +impl Div for Vector3 { + type Output = Self; + fn div(self, op: T) -> Self::Output { + Self::Output::new_xyz( + self.x / op, + self.y / op, + self.z / op, + ) + } +} + impl Neg for Vector3 { type Output = Self; -- cgit v1.2.3