fj_core/algorithms/intersect/
mod.rs1pub mod ray_segment;
4
5mod line_segment;
6
7use fj_math::{Point, Vector};
8
9pub use self::line_segment::LineSegmentIntersection;
10
11pub trait Intersect {
18 type Intersection;
20
21 fn intersect(self) -> Option<Self::Intersection>;
23}
24
25#[derive(Clone, Copy, Debug, Eq, PartialEq)]
30pub struct HorizontalRayToTheRight<const D: usize> {
31 pub origin: Point<D>,
33}
34
35impl<const D: usize> HorizontalRayToTheRight<D> {
36 pub fn direction(&self) -> Vector<D> {
38 let mut components = [0.; D];
39 components[0] = 1.;
40 components.into()
41 }
42}
43
44impl<P, const D: usize> From<P> for HorizontalRayToTheRight<D>
45where
46 P: Into<Point<D>>,
47{
48 fn from(point: P) -> Self {
49 Self {
50 origin: point.into(),
51 }
52 }
53}