aboutsummaryrefslogtreecommitdiff
path: root/src/hittable/sphere.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/hittable/sphere.rs')
-rw-r--r--src/hittable/sphere.rs22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/hittable/sphere.rs b/src/hittable/sphere.rs
index 783b788..f276366 100644
--- a/src/hittable/sphere.rs
+++ b/src/hittable/sphere.rs
@@ -1,9 +1,13 @@
-use std::sync::Arc;
use std::f64::consts;
+use std::sync::Arc;
-use crate::{hittable::{HitRecord, Hittable, AABB}, material::Material, vec3::Vec3};
use crate::ray::Ray;
use crate::vec3::Point3;
+use crate::{
+ hittable::{HitRecord, Hittable, AABB},
+ material::Material,
+ vec3::Vec3,
+};
pub struct Sphere {
pub center: Point3,
@@ -54,8 +58,18 @@ impl Hittable for Sphere {
fn bounding_box(&self, _: f64, _: f64) -> Option<AABB> {
Some(AABB {
- minimum: &self.center - Vec3 { x: self.radius, y: self.radius, z: self.radius },
- maximum: &self.center + Vec3 { x: self.radius, y: self.radius, z: self.radius },
+ minimum: &self.center
+ - Vec3 {
+ x: self.radius,
+ y: self.radius,
+ z: self.radius,
+ },
+ maximum: &self.center
+ + Vec3 {
+ x: self.radius,
+ y: self.radius,
+ z: self.radius,
+ },
})
}
}