From 5c8903107a98d049023414e4dfeee7aa6a0161c7 Mon Sep 17 00:00:00 2001 From: Matthew Gordon Date: Tue, 31 Dec 2019 22:16:06 -0500 Subject: [PATCH] Add IntersectP trait Like Intersect, but the intersect() function only returns a bool, not a Optional. --- src/raycasting/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/raycasting/mod.rs b/src/raycasting/mod.rs index 229c464..7917011 100644 --- a/src/raycasting/mod.rs +++ b/src/raycasting/mod.rs @@ -49,9 +49,14 @@ pub struct IntersectionInfo { } pub trait Intersect: Send + Sync { + /// Test if the ray intersects the object, and return information about the object and intersection. fn intersect<'a>(&'a self, ray: &Ray) -> Option>; } +pub trait IntersectP: Send + Sync { + /// Test if the ray intersects the object, without calculating any extra information. + fn intersect(&self, ray: &Ray) -> bool; +} #[cfg(test)] mod tests {