From ef63d3d375d5035d001a57d6007c61569123819e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 12 Aug 2022 14:25:20 +0200 Subject: [PATCH] Give more flexibility to `Intersect` impls --- .../src/algorithms/intersect/face_point.rs | 16 ++++++++-------- crates/fj-kernel/src/algorithms/intersect/mod.rs | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/intersect/face_point.rs b/crates/fj-kernel/src/algorithms/intersect/face_point.rs index 687a3fd88..acc873221 100644 --- a/crates/fj-kernel/src/algorithms/intersect/face_point.rs +++ b/crates/fj-kernel/src/algorithms/intersect/face_point.rs @@ -9,10 +9,10 @@ use crate::{ use super::Intersect; -impl Intersect for (Face, Point<2>) { +impl Intersect for (&Face, &Point<2>) { type Intersection = FacePointIntersection; - fn intersect(&self) -> Option { + fn intersect(self) -> Option { let (face, point) = self; let ray = HorizontalRayToTheRight { origin: *point }; @@ -114,7 +114,7 @@ mod tests { .into_face(); let point = Point::from([2., 1.]); - let intersection = (face, point).intersect(); + let intersection = (&face, &point).intersect(); assert_eq!(intersection, None); } @@ -125,7 +125,7 @@ mod tests { .into_face(); let point = Point::from([1., 1.]); - let intersection = (face, point).intersect(); + let intersection = (&face, &point).intersect(); assert_eq!( intersection, Some(FacePointIntersection::FaceContainsPoint) @@ -140,7 +140,7 @@ mod tests { .into_face(); let point = Point::from([1., 2.]); - let intersection = (face, point).intersect(); + let intersection = (&face, &point).intersect(); assert_eq!( intersection, Some(FacePointIntersection::FaceContainsPoint) @@ -154,7 +154,7 @@ mod tests { .into_face(); let point = Point::from([1., 1.]); - let intersection = (face, point).intersect(); + let intersection = (&face, &point).intersect(); assert_eq!( intersection, Some(FacePointIntersection::FaceContainsPoint) @@ -168,7 +168,7 @@ mod tests { .into_face(); let point = Point::from([1., 1.]); - let intersection = (face, point).intersect(); + let intersection = (&face, &point).intersect(); assert_eq!( intersection, Some(FacePointIntersection::FaceContainsPoint) @@ -188,7 +188,7 @@ mod tests { .into_face(); let point = Point::from([1., 1.]); - let intersection = (face, point).intersect(); + let intersection = (&face, &point).intersect(); assert_eq!( intersection, Some(FacePointIntersection::FaceContainsPoint) diff --git a/crates/fj-kernel/src/algorithms/intersect/mod.rs b/crates/fj-kernel/src/algorithms/intersect/mod.rs index 1a784197d..9cb251191 100644 --- a/crates/fj-kernel/src/algorithms/intersect/mod.rs +++ b/crates/fj-kernel/src/algorithms/intersect/mod.rs @@ -27,5 +27,5 @@ pub trait Intersect { type Intersection; /// Compute the intersection between a tuple of objects - fn intersect(&self) -> Option; + fn intersect(self) -> Option; }