aboutsummaryrefslogtreecommitdiff
path: root/src/world/shapes
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-03-06 16:15:26 +0100
committerJulian T <julian@jtle.dk>2021-03-06 16:15:26 +0100
commit3f78cacdd93036dbd51bae77d5d8e5430a0bc75f (patch)
tree13d5e08607f44f30664ee9ced3fb139faeb5a67d /src/world/shapes
parentda1c3949a449f3fafe579c62ff6b14ffd993a197 (diff)
Several changes to bounding boxes
For instance removed support for shapes without a bounding box, such as planes
Diffstat (limited to 'src/world/shapes')
-rw-r--r--src/world/shapes/sphere.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/world/shapes/sphere.rs b/src/world/shapes/sphere.rs
index 55fc8b4..e3348de 100644
--- a/src/world/shapes/sphere.rs
+++ b/src/world/shapes/sphere.rs
@@ -57,19 +57,18 @@ impl Hittable for Sphere {
/// # Examples
///
/// ```
- /// use rendering::core::{Vector3f, Hittable};
- /// use rendering::world::shapes::Sphere;
+ /// use rendering::core::Vector3f;
+ /// use rendering::world::{Hittable, shapes::Sphere};
///
/// let sph = Sphere::new(1.0, Vector3f::new(0.0));
- /// let b = sph.bounding_box().unwrap();
+ /// let b = sph.bounding_box();
///
/// assert!(b.min.x == -1.0 && b.min.y == -1.0 && b.min.z == -1.0);
/// assert!(b.max.x == 1.0 && b.max.y == 1.0 && b.max.z == 1.0);
- fn bounding_box(&self) -> Option<Bound3f> {
+ fn bounding_box(&self) -> Bound3f {
let offset = Vector3f::new(self.radius);
- Some(
- Bound3f::new(self.center - offset, self.center + offset)
- )
+
+ Bound3f::new(self.center - offset, self.center + offset)
}
}