Add IntersectP trait

Like Intersect, but the intersect() function only returns a bool,
not a Optional<IntersectionInfo>.
This commit is contained in:
Matthew Gordon 2019-12-31 22:16:06 -05:00
parent 6639ed813b
commit 5c8903107a
1 changed files with 5 additions and 0 deletions

View File

@ -49,9 +49,14 @@ pub struct IntersectionInfo<T: RealField> {
}
pub trait Intersect<T: RealField>: Send + Sync {
/// Test if the ray intersects the object, and return information about the object and intersection.
fn intersect<'a>(&'a self, ray: &Ray<T>) -> Option<IntersectionInfo<T>>;
}
pub trait IntersectP<T: RealField>: Send + Sync {
/// Test if the ray intersects the object, without calculating any extra information.
fn intersect(&self, ray: &Ray<T>) -> bool;
}
#[cfg(test)]
mod tests {