From b64c7e972c52b7d015d661866f0cf902370343e5 Mon Sep 17 00:00:00 2001 From: Julian T Date: Sat, 6 Feb 2021 23:43:06 +0100 Subject: Implement pathtracing --- src/core/vector3.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/core/vector3.rs') diff --git a/src/core/vector3.rs b/src/core/vector3.rs index 10de647..ef067aa 100644 --- a/src/core/vector3.rs +++ b/src/core/vector3.rs @@ -50,6 +50,18 @@ impl Add for Vector3 { } } +impl Add for Vector3 { + type Output = Self; + + fn add(self, op: T) -> Self::Output { + Self::new_xyz( + self.x + op, + self.y + op, + self.z + op, + ) + } +} + impl Mul for Vector3 { type Output = Self; fn mul(self, op: T) -> Self::Output { @@ -114,6 +126,7 @@ impl Vector3f { /// assert!(v.x == 1.0); /// ``` pub fn norm_in(&mut self) { + // TODO Experiment with checking for normality with len_squared let len = self.len(); if len == 0.0 { *self = Self::new(0.0); -- cgit v1.2.3