diff options
Diffstat (limited to 'src/hittable/triangle.rs')
-rw-r--r-- | src/hittable/triangle.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/hittable/triangle.rs b/src/hittable/triangle.rs index 0fe5fc4..82b9e18 100644 --- a/src/hittable/triangle.rs +++ b/src/hittable/triangle.rs @@ -1,6 +1,11 @@ use std::sync::Arc; -use crate::{hittable::{HitRecord, Hittable, AABB}, material::Material, ray::Ray, vec3::{Point3, Vec3}}; +use crate::{ + hittable::{HitRecord, Hittable, AABB}, + material::Material, + ray::Ray, + vec3::{Point3, Vec3}, +}; pub struct Triangle { pub v0: Point3, @@ -12,7 +17,9 @@ pub struct Triangle { impl Triangle { fn has_vertex_at_infinity(&self) -> bool { - self.v0.has_infinite_member() || self.v1.has_infinite_member() || self.v2.has_infinite_member() + self.v0.has_infinite_member() + || self.v1.has_infinite_member() + || self.v2.has_infinite_member() } } @@ -71,9 +78,9 @@ impl Hittable for Triangle { maximum: Point3 { x: self.v0.x.max(self.v1.x).max(self.v2.x) + 0.0001, y: self.v0.y.max(self.v1.y).max(self.v2.y) + 0.0001, - z: self.v0.z.max(self.v1.z).max(self.v2.z) + 0.0001, + z: self.v0.z.max(self.v1.z).max(self.v2.z) + 0.0001, }, - }) + }), } } } |