Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give more flexibility to Intersect impls #948

Merged
merged 1 commit into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions crates/fj-kernel/src/algorithms/intersect/face_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self::Intersection> {
fn intersect(self) -> Option<Self::Intersection> {
let (face, point) = self;

let ray = HorizontalRayToTheRight { origin: *point };
Expand Down Expand Up @@ -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);
}

Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-kernel/src/algorithms/intersect/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ pub trait Intersect {
type Intersection;

/// Compute the intersection between a tuple of objects
fn intersect(&self) -> Option<Self::Intersection>;
fn intersect(self) -> Option<Self::Intersection>;
}