aboutsummaryrefslogtreecommitdiff
path: root/src/core/bound3.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/bound3.rs
parent351d9132c0b2c54dfa9f50bfe328d25ccf059cea (diff)
Add translation and move center position from sphere
Diffstat (limited to 'src/core/bound3.rs')
-rw-r--r--src/core/bound3.rs8
1 files changed, 7 insertions, 1 deletions
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<T: Number> Bound3<T> {
let diag = self.max - self.min;
diag.x * diag.y * diag.z
}
+
+ pub fn offset(&self, offset: Vector3<T>) -> 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 {