aboutsummaryrefslogtreecommitdiff
path: root/src/hittable/sphere.rs
diff options
context:
space:
mode:
authorlamp2024-01-21 17:03:07 +0000
committerlamp2024-01-21 17:03:07 +0000
commit45fafbcd4b41a5388ece377c4e051b5846407288 (patch)
tree2192c471ca3b47671f0906e27f6f6088f40b3d8a /src/hittable/sphere.rs
parent89a5c9a8a0cdf627cda0e31da454f83ca21315ce (diff)
fmt and tidy
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,
+ },
})
}
}