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/bound3.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/core/bound3.rs') diff --git a/src/core/bound3.rs b/src/core/bound3.rs index ce6bb09..8c467c0 100644 --- a/src/core/bound3.rs +++ b/src/core/bound3.rs @@ -64,6 +64,13 @@ impl Bound3 { let diag = self.max - self.min; diag.x * diag.y * diag.z } + + pub fn offset(&self, offset: Vector3) -> Self { + Self { + min: self.min + offset, + max: self.max + offset, + } + } } impl Bound3f { @@ -86,7 +93,6 @@ impl Bound3f { /// assert!(!b.intersect(&r3, 0.0, INFTY)); /// ``` pub fn intersect(&self, ray: &Ray, t_min: Float, t_max: Float) -> bool { - println!("BIN: {} -> {}", self.min, self.max); // Method stolen from Ray tracing the next week. // They mention its from pixar for i in 0..3 { -- cgit v1.2.3