From 951e2561ae5f0975574078211b9ce6c6c7cefeea Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 10 Aug 2022 13:35:38 +0200 Subject: [PATCH 1/6] Rename module I think the new name is a bit better, as it succinctly describes what the module does, instead of trying to make a noun out of that. --- crates/fj-kernel/src/algorithms/{ray_cast.rs => cast_ray.rs} | 0 crates/fj-kernel/src/algorithms/mod.rs | 2 +- crates/fj-kernel/src/algorithms/triangulate/polygon.rs | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename crates/fj-kernel/src/algorithms/{ray_cast.rs => cast_ray.rs} (100%) diff --git a/crates/fj-kernel/src/algorithms/ray_cast.rs b/crates/fj-kernel/src/algorithms/cast_ray.rs similarity index 100% rename from crates/fj-kernel/src/algorithms/ray_cast.rs rename to crates/fj-kernel/src/algorithms/cast_ray.rs diff --git a/crates/fj-kernel/src/algorithms/mod.rs b/crates/fj-kernel/src/algorithms/mod.rs index 08319f8a7..889f66288 100644 --- a/crates/fj-kernel/src/algorithms/mod.rs +++ b/crates/fj-kernel/src/algorithms/mod.rs @@ -9,8 +9,8 @@ mod sweep; mod transform; mod triangulate; +pub mod cast_ray; pub mod intersection; -pub mod ray_cast; pub use self::{ approx::{CycleApprox, FaceApprox, InvalidTolerance, Tolerance}, diff --git a/crates/fj-kernel/src/algorithms/triangulate/polygon.rs b/crates/fj-kernel/src/algorithms/triangulate/polygon.rs index eac7d93e8..34d66bd76 100644 --- a/crates/fj-kernel/src/algorithms/triangulate/polygon.rs +++ b/crates/fj-kernel/src/algorithms/triangulate/polygon.rs @@ -2,7 +2,7 @@ use fj_interop::debug::{DebugInfo, TriangleEdgeCheck}; use fj_math::{Point, PolyChain, Segment}; use crate::{ - algorithms::ray_cast::{HorizontalRayToTheRight, RaySegmentHit}, + algorithms::cast_ray::{HorizontalRayToTheRight, RaySegmentHit}, objects::Surface, }; From 11e00ca9648d9c9e0d56b507e549c1cae3fce633 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 10 Aug 2022 13:41:09 +0200 Subject: [PATCH 2/6] Add `CastRay` trait --- crates/fj-kernel/src/algorithms/cast_ray.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/fj-kernel/src/algorithms/cast_ray.rs b/crates/fj-kernel/src/algorithms/cast_ray.rs index 89d9e6f51..2da505fe7 100644 --- a/crates/fj-kernel/src/algorithms/cast_ray.rs +++ b/crates/fj-kernel/src/algorithms/cast_ray.rs @@ -2,6 +2,15 @@ use fj_math::{Point, Segment}; +/// Implemented by types that support ray casting +pub trait CastRay { + /// The type that describes a hit of the ray on the implementing type + type Hit; + + /// Cast a ray against `self` + fn cast_ray(&self, ray: HorizontalRayToTheRight) -> Option; +} + /// A horizontal ray that goes to the right /// /// For in-kernel use, we don't need anything more flexible, and being exactly From 95846015a1356ea5d5bd7c86bdc82690e763b9a2 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 10 Aug 2022 13:49:53 +0200 Subject: [PATCH 3/6] Derive some traits for `HorizontalRayToTheRight` --- crates/fj-kernel/src/algorithms/cast_ray.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/fj-kernel/src/algorithms/cast_ray.rs b/crates/fj-kernel/src/algorithms/cast_ray.rs index 2da505fe7..1acb76cf9 100644 --- a/crates/fj-kernel/src/algorithms/cast_ray.rs +++ b/crates/fj-kernel/src/algorithms/cast_ray.rs @@ -15,6 +15,7 @@ pub trait CastRay { /// /// For in-kernel use, we don't need anything more flexible, and being exactly /// horizontal simplifies some calculations. +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub struct HorizontalRayToTheRight { /// The point where the ray originates pub origin: Point, From 221bf121cdc1863ceee9a6dfa65ac5c9f99a942d Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 10 Aug 2022 13:57:34 +0200 Subject: [PATCH 4/6] Convert method into trait implementation --- crates/fj-kernel/src/algorithms/cast_ray.rs | 108 +++++++++--------- .../src/algorithms/triangulate/polygon.rs | 10 +- 2 files changed, 59 insertions(+), 59 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/cast_ray.rs b/crates/fj-kernel/src/algorithms/cast_ray.rs index 1acb76cf9..b67f1e914 100644 --- a/crates/fj-kernel/src/algorithms/cast_ray.rs +++ b/crates/fj-kernel/src/algorithms/cast_ray.rs @@ -11,39 +11,30 @@ pub trait CastRay { fn cast_ray(&self, ray: HorizontalRayToTheRight) -> Option; } -/// A horizontal ray that goes to the right -/// -/// For in-kernel use, we don't need anything more flexible, and being exactly -/// horizontal simplifies some calculations. -#[derive(Clone, Copy, Debug, Eq, PartialEq)] -pub struct HorizontalRayToTheRight { - /// The point where the ray originates - pub origin: Point, -} +impl CastRay<2> for Segment<2> { + type Hit = RaySegmentHit; -impl HorizontalRayToTheRight<2> { - /// Determine whether the ray hits the given line segment - pub fn hits_segment( + fn cast_ray( &self, - segment: impl Into>, + ray: HorizontalRayToTheRight<2>, ) -> Option { - let [a, b] = segment.into().points(); + let [a, b] = self.points(); let [lower, upper] = if a.v <= b.v { [a, b] } else { [b, a] }; let right = if a.u > b.u { a } else { b }; - if self.origin.v > upper.v { + if ray.origin.v > upper.v { // ray is above segment return None; } - if self.origin.v < lower.v { + if ray.origin.v < lower.v { // ray is below segment return None; } - if self.origin.v == lower.v && lower.v == upper.v { + if ray.origin.v == lower.v && lower.v == upper.v { // ray and segment are parallel and at same height - if self.origin.u > right.u { + if ray.origin.u > right.u { return None; } @@ -59,17 +50,17 @@ impl HorizontalRayToTheRight<2> { y: upper.v, }; let pc = robust::Coord { - x: self.origin.u, - y: self.origin.v, + x: ray.origin.u, + y: ray.origin.v, }; if robust::orient2d(pa, pb, pc) >= 0. { // ray starts on the line or left of it - if self.origin.v == upper.v { + if ray.origin.v == upper.v { return Some(RaySegmentHit::UpperVertex); } - if self.origin.v == lower.v { + if ray.origin.v == lower.v { return Some(RaySegmentHit::LowerVertex); } @@ -80,6 +71,16 @@ impl HorizontalRayToTheRight<2> { } } +/// A horizontal ray that goes to the right +/// +/// For in-kernel use, we don't need anything more flexible, and being exactly +/// horizontal simplifies some calculations. +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub struct HorizontalRayToTheRight { + /// The point where the ray originates + pub origin: Point, +} + impl From

for HorizontalRayToTheRight where P: Into>, @@ -109,20 +110,24 @@ pub enum RaySegmentHit { #[cfg(test)] mod tests { + use fj_math::Segment; + + use crate::algorithms::cast_ray::CastRay; + use super::{HorizontalRayToTheRight, RaySegmentHit}; #[test] fn hits_segment_right() { let ray = HorizontalRayToTheRight::from([0., 2.]); - let below = [[1., 0.], [1., 1.]]; - let above = [[1., 3.], [1., 4.]]; - let same_level = [[1., 1.], [1., 3.]]; + let below = Segment::from([[1., 0.], [1., 1.]]); + let above = Segment::from([[1., 3.], [1., 4.]]); + let same_level = Segment::from([[1., 1.], [1., 3.]]); - assert!(ray.hits_segment(below).is_none()); - assert!(ray.hits_segment(above).is_none()); + assert!(below.cast_ray(ray).is_none()); + assert!(above.cast_ray(ray).is_none()); assert!(matches!( - ray.hits_segment(same_level), + same_level.cast_ray(ray), Some(RaySegmentHit::Segment) )); } @@ -131,31 +136,31 @@ mod tests { fn hits_segment_left() { let ray = HorizontalRayToTheRight::from([1., 2.]); - let same_level = [[0., 1.], [0., 3.]]; - assert!(ray.hits_segment(same_level).is_none()); + let same_level = Segment::from([[0., 1.], [0., 3.]]); + assert!(same_level.cast_ray(ray).is_none()); } #[test] fn hits_segment_overlapping() { let ray = HorizontalRayToTheRight::from([1., 1.]); - let no_hit = [[0., 0.], [2., 3.]]; + let no_hit = Segment::from([[0., 0.], [2., 3.]]); - let hit_segment = [[0., 0.], [3., 2.]]; - let hit_upper = [[0., 0.], [2., 1.]]; - let hit_lower = [[0., 2.], [2., 1.]]; + let hit_segment = Segment::from([[0., 0.], [3., 2.]]); + let hit_upper = Segment::from([[0., 0.], [2., 1.]]); + let hit_lower = Segment::from([[0., 2.], [2., 1.]]); - assert!(ray.hits_segment(no_hit).is_none()); + assert!(no_hit.cast_ray(ray).is_none()); assert!(matches!( - ray.hits_segment(hit_segment), + hit_segment.cast_ray(ray), Some(RaySegmentHit::Segment) )); assert!(matches!( - ray.hits_segment(hit_upper), + hit_upper.cast_ray(ray), Some(RaySegmentHit::UpperVertex), )); assert!(matches!( - ray.hits_segment(hit_lower), + hit_lower.cast_ray(ray), Some(RaySegmentHit::LowerVertex), )); } @@ -164,20 +169,20 @@ mod tests { fn hits_segment_on_segment() { let ray = HorizontalRayToTheRight::from([1., 1.]); - let hit_segment = [[0., 0.], [2., 2.]]; - let hit_upper = [[0., 0.], [1., 1.]]; - let hit_lower = [[1., 1.], [2., 2.]]; + let hit_segment = Segment::from([[0., 0.], [2., 2.]]); + let hit_upper = Segment::from([[0., 0.], [1., 1.]]); + let hit_lower = Segment::from([[1., 1.], [2., 2.]]); assert!(matches!( - ray.hits_segment(hit_segment), + hit_segment.cast_ray(ray), Some(RaySegmentHit::Segment) )); assert!(matches!( - ray.hits_segment(hit_upper), + hit_upper.cast_ray(ray), Some(RaySegmentHit::UpperVertex), )); assert!(matches!( - ray.hits_segment(hit_lower), + hit_lower.cast_ray(ray), Some(RaySegmentHit::LowerVertex), )); } @@ -186,18 +191,15 @@ mod tests { fn hits_segment_parallel() { let ray = HorizontalRayToTheRight::from([2., 0.]); - let left = [[0., 0.], [1., 0.]]; - let overlapping = [[1., 0.], [3., 0.]]; - let right = [[3., 0.], [4., 0.]]; + let left = Segment::from([[0., 0.], [1., 0.]]); + let overlapping = Segment::from([[1., 0.], [3., 0.]]); + let right = Segment::from([[3., 0.], [4., 0.]]); - assert!(ray.hits_segment(left).is_none()); - assert!(matches!( - ray.hits_segment(overlapping), - Some(RaySegmentHit::Parallel) - )); + assert!(left.cast_ray(ray).is_none()); assert!(matches!( - ray.hits_segment(right), + overlapping.cast_ray(ray), Some(RaySegmentHit::Parallel) )); + assert!(matches!(right.cast_ray(ray), Some(RaySegmentHit::Parallel))); } } diff --git a/crates/fj-kernel/src/algorithms/triangulate/polygon.rs b/crates/fj-kernel/src/algorithms/triangulate/polygon.rs index 34d66bd76..b53aca5a7 100644 --- a/crates/fj-kernel/src/algorithms/triangulate/polygon.rs +++ b/crates/fj-kernel/src/algorithms/triangulate/polygon.rs @@ -2,7 +2,7 @@ use fj_interop::debug::{DebugInfo, TriangleEdgeCheck}; use fj_math::{Point, PolyChain, Segment}; use crate::{ - algorithms::cast_ray::{HorizontalRayToTheRight, RaySegmentHit}, + algorithms::cast_ray::{CastRay, HorizontalRayToTheRight, RaySegmentHit}, objects::Surface, }; @@ -154,13 +154,11 @@ impl Polygon { // first segment. The logic in the loop properly takes care of that, // as long as we initialize the `previous_hit` variable with the // result of the last segment. - let mut previous_hit = edges - .last() - .copied() - .and_then(|edge| ray.hits_segment(edge)); + let mut previous_hit = + edges.last().copied().and_then(|edge| edge.cast_ray(ray)); for edge in edges { - let hit = ray.hits_segment(edge); + let hit = edge.cast_ray(ray); let count_hit = match (hit, previous_hit) { (Some(RaySegmentHit::Segment), _) => { From 1409dedc0407b1fb87575be0320f783ec1b0911d Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 10 Aug 2022 14:00:22 +0200 Subject: [PATCH 5/6] Move ray/segment code to dedicated module --- crates/fj-kernel/src/algorithms/cast_ray.rs | 178 +----------------- .../src/algorithms/cast_ray/segment.rs | 175 +++++++++++++++++ 2 files changed, 180 insertions(+), 173 deletions(-) create mode 100644 crates/fj-kernel/src/algorithms/cast_ray/segment.rs diff --git a/crates/fj-kernel/src/algorithms/cast_ray.rs b/crates/fj-kernel/src/algorithms/cast_ray.rs index b67f1e914..7496fc786 100644 --- a/crates/fj-kernel/src/algorithms/cast_ray.rs +++ b/crates/fj-kernel/src/algorithms/cast_ray.rs @@ -1,6 +1,10 @@ //! Ray casting -use fj_math::{Point, Segment}; +mod segment; + +pub use self::segment::RaySegmentHit; + +use fj_math::Point; /// Implemented by types that support ray casting pub trait CastRay { @@ -11,66 +15,6 @@ pub trait CastRay { fn cast_ray(&self, ray: HorizontalRayToTheRight) -> Option; } -impl CastRay<2> for Segment<2> { - type Hit = RaySegmentHit; - - fn cast_ray( - &self, - ray: HorizontalRayToTheRight<2>, - ) -> Option { - let [a, b] = self.points(); - let [lower, upper] = if a.v <= b.v { [a, b] } else { [b, a] }; - let right = if a.u > b.u { a } else { b }; - - if ray.origin.v > upper.v { - // ray is above segment - return None; - } - if ray.origin.v < lower.v { - // ray is below segment - return None; - } - - if ray.origin.v == lower.v && lower.v == upper.v { - // ray and segment are parallel and at same height - - if ray.origin.u > right.u { - return None; - } - - return Some(RaySegmentHit::Parallel); - } - - let pa = robust::Coord { - x: lower.u, - y: lower.v, - }; - let pb = robust::Coord { - x: upper.u, - y: upper.v, - }; - let pc = robust::Coord { - x: ray.origin.u, - y: ray.origin.v, - }; - - if robust::orient2d(pa, pb, pc) >= 0. { - // ray starts on the line or left of it - - if ray.origin.v == upper.v { - return Some(RaySegmentHit::UpperVertex); - } - if ray.origin.v == lower.v { - return Some(RaySegmentHit::LowerVertex); - } - - return Some(RaySegmentHit::Segment); - } - - None - } -} - /// A horizontal ray that goes to the right /// /// For in-kernel use, we don't need anything more flexible, and being exactly @@ -91,115 +35,3 @@ where } } } - -/// A hit between a ray and a line segment -#[derive(Clone, Copy, Debug, Eq, PartialEq)] -pub enum RaySegmentHit { - /// The ray hit the segment itself - Segment, - - /// The ray hit the lower vertex of the segment - LowerVertex, - - /// The ray hit the upper vertex of the segment - UpperVertex, - - /// The ray hit the whole segment, as it is parallel to the ray - Parallel, -} - -#[cfg(test)] -mod tests { - use fj_math::Segment; - - use crate::algorithms::cast_ray::CastRay; - - use super::{HorizontalRayToTheRight, RaySegmentHit}; - - #[test] - fn hits_segment_right() { - let ray = HorizontalRayToTheRight::from([0., 2.]); - - let below = Segment::from([[1., 0.], [1., 1.]]); - let above = Segment::from([[1., 3.], [1., 4.]]); - let same_level = Segment::from([[1., 1.], [1., 3.]]); - - assert!(below.cast_ray(ray).is_none()); - assert!(above.cast_ray(ray).is_none()); - assert!(matches!( - same_level.cast_ray(ray), - Some(RaySegmentHit::Segment) - )); - } - - #[test] - fn hits_segment_left() { - let ray = HorizontalRayToTheRight::from([1., 2.]); - - let same_level = Segment::from([[0., 1.], [0., 3.]]); - assert!(same_level.cast_ray(ray).is_none()); - } - - #[test] - fn hits_segment_overlapping() { - let ray = HorizontalRayToTheRight::from([1., 1.]); - - let no_hit = Segment::from([[0., 0.], [2., 3.]]); - - let hit_segment = Segment::from([[0., 0.], [3., 2.]]); - let hit_upper = Segment::from([[0., 0.], [2., 1.]]); - let hit_lower = Segment::from([[0., 2.], [2., 1.]]); - - assert!(no_hit.cast_ray(ray).is_none()); - assert!(matches!( - hit_segment.cast_ray(ray), - Some(RaySegmentHit::Segment) - )); - assert!(matches!( - hit_upper.cast_ray(ray), - Some(RaySegmentHit::UpperVertex), - )); - assert!(matches!( - hit_lower.cast_ray(ray), - Some(RaySegmentHit::LowerVertex), - )); - } - - #[test] - fn hits_segment_on_segment() { - let ray = HorizontalRayToTheRight::from([1., 1.]); - - let hit_segment = Segment::from([[0., 0.], [2., 2.]]); - let hit_upper = Segment::from([[0., 0.], [1., 1.]]); - let hit_lower = Segment::from([[1., 1.], [2., 2.]]); - - assert!(matches!( - hit_segment.cast_ray(ray), - Some(RaySegmentHit::Segment) - )); - assert!(matches!( - hit_upper.cast_ray(ray), - Some(RaySegmentHit::UpperVertex), - )); - assert!(matches!( - hit_lower.cast_ray(ray), - Some(RaySegmentHit::LowerVertex), - )); - } - - #[test] - fn hits_segment_parallel() { - let ray = HorizontalRayToTheRight::from([2., 0.]); - - let left = Segment::from([[0., 0.], [1., 0.]]); - let overlapping = Segment::from([[1., 0.], [3., 0.]]); - let right = Segment::from([[3., 0.], [4., 0.]]); - - assert!(left.cast_ray(ray).is_none()); - assert!(matches!( - overlapping.cast_ray(ray), - Some(RaySegmentHit::Parallel) - )); - assert!(matches!(right.cast_ray(ray), Some(RaySegmentHit::Parallel))); - } -} diff --git a/crates/fj-kernel/src/algorithms/cast_ray/segment.rs b/crates/fj-kernel/src/algorithms/cast_ray/segment.rs new file mode 100644 index 000000000..e0fcdebe6 --- /dev/null +++ b/crates/fj-kernel/src/algorithms/cast_ray/segment.rs @@ -0,0 +1,175 @@ +use fj_math::Segment; + +use super::{CastRay, HorizontalRayToTheRight}; + +impl CastRay<2> for Segment<2> { + type Hit = RaySegmentHit; + + fn cast_ray( + &self, + ray: HorizontalRayToTheRight<2>, + ) -> Option { + let [a, b] = self.points(); + let [lower, upper] = if a.v <= b.v { [a, b] } else { [b, a] }; + let right = if a.u > b.u { a } else { b }; + + if ray.origin.v > upper.v { + // ray is above segment + return None; + } + if ray.origin.v < lower.v { + // ray is below segment + return None; + } + + if ray.origin.v == lower.v && lower.v == upper.v { + // ray and segment are parallel and at same height + + if ray.origin.u > right.u { + return None; + } + + return Some(RaySegmentHit::Parallel); + } + + let pa = robust::Coord { + x: lower.u, + y: lower.v, + }; + let pb = robust::Coord { + x: upper.u, + y: upper.v, + }; + let pc = robust::Coord { + x: ray.origin.u, + y: ray.origin.v, + }; + + if robust::orient2d(pa, pb, pc) >= 0. { + // ray starts on the line or left of it + + if ray.origin.v == upper.v { + return Some(RaySegmentHit::UpperVertex); + } + if ray.origin.v == lower.v { + return Some(RaySegmentHit::LowerVertex); + } + + return Some(RaySegmentHit::Segment); + } + + None + } +} + +/// A hit between a ray and a line segment +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum RaySegmentHit { + /// The ray hit the segment itself + Segment, + + /// The ray hit the lower vertex of the segment + LowerVertex, + + /// The ray hit the upper vertex of the segment + UpperVertex, + + /// The ray hit the whole segment, as it is parallel to the ray + Parallel, +} + +#[cfg(test)] +mod tests { + use fj_math::Segment; + + use crate::algorithms::cast_ray::CastRay; + + use super::{HorizontalRayToTheRight, RaySegmentHit}; + + #[test] + fn hits_segment_right() { + let ray = HorizontalRayToTheRight::from([0., 2.]); + + let below = Segment::from([[1., 0.], [1., 1.]]); + let above = Segment::from([[1., 3.], [1., 4.]]); + let same_level = Segment::from([[1., 1.], [1., 3.]]); + + assert!(below.cast_ray(ray).is_none()); + assert!(above.cast_ray(ray).is_none()); + assert!(matches!( + same_level.cast_ray(ray), + Some(RaySegmentHit::Segment) + )); + } + + #[test] + fn hits_segment_left() { + let ray = HorizontalRayToTheRight::from([1., 2.]); + + let same_level = Segment::from([[0., 1.], [0., 3.]]); + assert!(same_level.cast_ray(ray).is_none()); + } + + #[test] + fn hits_segment_overlapping() { + let ray = HorizontalRayToTheRight::from([1., 1.]); + + let no_hit = Segment::from([[0., 0.], [2., 3.]]); + + let hit_segment = Segment::from([[0., 0.], [3., 2.]]); + let hit_upper = Segment::from([[0., 0.], [2., 1.]]); + let hit_lower = Segment::from([[0., 2.], [2., 1.]]); + + assert!(no_hit.cast_ray(ray).is_none()); + assert!(matches!( + hit_segment.cast_ray(ray), + Some(RaySegmentHit::Segment) + )); + assert!(matches!( + hit_upper.cast_ray(ray), + Some(RaySegmentHit::UpperVertex), + )); + assert!(matches!( + hit_lower.cast_ray(ray), + Some(RaySegmentHit::LowerVertex), + )); + } + + #[test] + fn hits_segment_on_segment() { + let ray = HorizontalRayToTheRight::from([1., 1.]); + + let hit_segment = Segment::from([[0., 0.], [2., 2.]]); + let hit_upper = Segment::from([[0., 0.], [1., 1.]]); + let hit_lower = Segment::from([[1., 1.], [2., 2.]]); + + assert!(matches!( + hit_segment.cast_ray(ray), + Some(RaySegmentHit::Segment) + )); + assert!(matches!( + hit_upper.cast_ray(ray), + Some(RaySegmentHit::UpperVertex), + )); + assert!(matches!( + hit_lower.cast_ray(ray), + Some(RaySegmentHit::LowerVertex), + )); + } + + #[test] + fn hits_segment_parallel() { + let ray = HorizontalRayToTheRight::from([2., 0.]); + + let left = Segment::from([[0., 0.], [1., 0.]]); + let overlapping = Segment::from([[1., 0.], [3., 0.]]); + let right = Segment::from([[3., 0.], [4., 0.]]); + + assert!(left.cast_ray(ray).is_none()); + assert!(matches!( + overlapping.cast_ray(ray), + Some(RaySegmentHit::Parallel) + )); + assert!(matches!(right.cast_ray(ray), Some(RaySegmentHit::Parallel))); + } +} From 8f934950e0da02873cde16741c78a21fbf8410e6 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 10 Aug 2022 14:01:52 +0200 Subject: [PATCH 6/6] Update module structure --- crates/fj-kernel/src/algorithms/{cast_ray.rs => cast_ray/mod.rs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename crates/fj-kernel/src/algorithms/{cast_ray.rs => cast_ray/mod.rs} (100%) diff --git a/crates/fj-kernel/src/algorithms/cast_ray.rs b/crates/fj-kernel/src/algorithms/cast_ray/mod.rs similarity index 100% rename from crates/fj-kernel/src/algorithms/cast_ray.rs rename to crates/fj-kernel/src/algorithms/cast_ray/mod.rs