1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use fj_math::Segment;
use crate::{
algorithms::intersect::{HorizontalRayToTheRight, Intersect},
geometry::path::SurfacePath,
objects::HalfEdge,
storage::Handle,
};
use super::ray_segment::RaySegmentIntersection;
impl Intersect for (&HorizontalRayToTheRight<2>, &Handle<HalfEdge>) {
type Intersection = RaySegmentIntersection;
fn intersect(self) -> Option<Self::Intersection> {
let (ray, edge) = self;
let line = match edge.curve().path() {
SurfacePath::Line(line) => line,
SurfacePath::Circle(_) => {
todo!("Casting rays against circles is not supported yet")
}
};
let points = edge.vertices().clone().map(|vertex| {
let point = vertex.position();
line.point_from_line_coords(point)
});
let segment = Segment::from_points(points);
(ray, &segment).intersect()
}
}