rene/geometries/segment/
locatable.rs1use crate::geometries::Point;
2use crate::locatable::{Locatable, Location};
3use crate::operations::{is_point_in_segment, Orient};
4use crate::traits::Elemental;
5
6use super::types::Segment;
7
8impl<Scalar: PartialOrd> Locatable<&Point<Scalar>> for &Segment<Scalar>
9where
10 Point<Scalar>: PartialEq,
11 for<'a> &'a Point<Scalar>: Elemental<Coordinate = &'a Scalar> + Orient,
12{
13 fn locate(self, point: &Point<Scalar>) -> Location {
14 if is_point_in_segment(point, &self.start, &self.end) {
15 Location::Boundary
16 } else {
17 Location::Exterior
18 }
19 }
20}