From 45fafbcd4b41a5388ece377c4e051b5846407288 Mon Sep 17 00:00:00 2001 From: lamp Date: Sun, 21 Jan 2024 17:03:07 +0000 Subject: fmt and tidy --- src/hittable/instance/translate.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/hittable/instance/translate.rs') diff --git a/src/hittable/instance/translate.rs b/src/hittable/instance/translate.rs index a9c8162..8478bd4 100644 --- a/src/hittable/instance/translate.rs +++ b/src/hittable/instance/translate.rs @@ -1,6 +1,10 @@ use std::sync::Arc; -use crate::{hittable::{HitRecord, Hittable, AABB}, ray::Ray, vec3::Vec3}; +use crate::{ + hittable::{HitRecord, Hittable, AABB}, + ray::Ray, + vec3::Vec3, +}; pub struct Translate { pub hittable: Arc, @@ -9,7 +13,11 @@ pub struct Translate { impl Hittable for Translate { fn hit(&self, ray: &Ray, t_min: f64, t_max: f64) -> Option { - let moved_ray = Ray { origin: &ray.origin - &self.offset, direction: ray.direction.clone(), time: ray.time }; + let moved_ray = Ray { + origin: &ray.origin - &self.offset, + direction: ray.direction.clone(), + time: ray.time, + }; let mut hit_record = self.hittable.hit(&moved_ray, t_min, t_max)?; hit_record.p += self.offset.clone(); let normal = hit_record.normal.clone(); -- cgit v1.2.3