diff --git a/crates/fj-kernel/src/algorithms/intersect/mod.rs b/crates/fj-kernel/src/algorithms/intersect/mod.rs index 8a5ca26b8..49754eeb3 100644 --- a/crates/fj-kernel/src/algorithms/intersect/mod.rs +++ b/crates/fj-kernel/src/algorithms/intersect/mod.rs @@ -11,7 +11,7 @@ mod face_face; mod line_segment; mod surface_surface; -use fj_math::Point; +use fj_math::{Point, Vector}; pub use self::{ curve_edge::CurveEdgeIntersection, @@ -45,6 +45,15 @@ pub struct HorizontalRayToTheRight { pub origin: Point, } +impl HorizontalRayToTheRight { + /// Access the direction of this ray + pub fn direction(&self) -> Vector { + let mut components = [0.; D]; + components[0] = 1.; + components.into() + } +} + impl From

for HorizontalRayToTheRight where P: Into>, diff --git a/crates/fj-kernel/src/algorithms/intersect/ray_face.rs b/crates/fj-kernel/src/algorithms/intersect/ray_face.rs index 30e9ee513..359de4a50 100644 --- a/crates/fj-kernel/src/algorithms/intersect/ray_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/ray_face.rs @@ -1,6 +1,6 @@ //! Intersection between a ray and a face, in 3D -use fj_math::{Point, Scalar, Vector}; +use fj_math::{Point, Scalar}; use crate::{ algorithms::intersect::face_point::FacePointIntersection, @@ -28,9 +28,7 @@ impl Intersect for (&HorizontalRayToTheRight<3>, &Face) { let plane_and_ray_are_parallel = { let plane_normal = plane_direction_1.cross(&plane_direction_2); - let ray_direction = Vector::from([1., 0., 0.]); - - plane_normal.dot(&ray_direction) == Scalar::ZERO + plane_normal.dot(&ray.direction()) == Scalar::ZERO }; if plane_and_ray_are_parallel { diff --git a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs index a117eff72..f92425b64 100644 --- a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs +++ b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs @@ -81,6 +81,7 @@ fn plane_from_surface(surface: &Surface) -> Plane { #[cfg(test)] mod tests { use fj_math::Transform; + use pretty_assertions::assert_eq; use crate::{ algorithms::transform::TransformObject,