pub fn intersect_line(&self, other: &Self) -> Option<Self> {
        assert!(other.is_line(), "tried to intersect with a point variant!");

        let line = other.line();
        match *self {
            LineOrPoint::Point(p) => {
                if <T as HasKernel>::Ker::orient2d(line.start, p.coord(), line.end)
                    == Orientation::Collinear
                {
                    let ls = line.start.into();
                    let le = line.end.into();
                    if p >= ls && p <= le {
                        Some(*self)
                    } else {
                        None
                    }
                } else {
                    None
                }
            }
            LineOrPoint::Line(p, q) => {
                use geo::algorithm::line_intersection::line_intersection;
                line_intersection(Line::new(p.coord(), q.coord()), line).map(|l| match l {
                    LineIntersection::SinglePoint { intersection, .. } => intersection.into(),
                    LineIntersection::Collinear { intersection } => intersection.into(),
                })
            }
        }
    }
/// Intersect a line with self and return a point, a overlapping segment or `None`.
///
/// The `other` argument must be a line variant (panics otherwise).
Intersect a line with self and return a point, a overlapping segment or `None`.
The `other` argument must be a line variant (panics otherwise).
Intersect a line with self and return a point a overlapping segment or ` None ` . The ` other ` argument must be a line variant ( panics otherwise ) .
pub fn intersect_line(&self, other: &Self) -> Option<Self> {
        assert!(other.is_line(), "tried to intersect with a point variant!");
        let line = other.line();
        match *self {
            LineOrPoint::Point(p) => {
                if <T as HasKernel>::Ker::orient2d(line.start, p.coord(), line.end)
                    == Orientation::Collinear
                {
                    let ls = line.start.into();
                    let le = line.end.into();
                    if p >= ls && p <= le {
                        Some(*self)
                    } else {
                        None
                    }
                } else {
                    None
                }
            }
            LineOrPoint::Line(p, q) => {
                use geo::algorithm::line_intersection::line_intersection;
                line_intersection(Line::new(p.coord(), q.coord()), line).map(|l| match l {
                    LineIntersection::SinglePoint { intersection, .. } => intersection.into(),
                    LineIntersection::Collinear { intersection } => intersection.into(),
                })
            }
        }
    }
pub fn intersect_line ( & self , other : & Self ) -> Option < Self > { assert ! ( other is_line ( ) " " ) ; let line = other . line ( ) ; match * self { LineOrPoint :: Point ( p ) => { if < T as HasKernel > :: Ker :: orient2d ( line . start , p . coord ( ) , line . end ) == Orientation :: Collinear { let ls = line . start . into ( ) ; let le = line . end . into ( ) ; if p >= ls && p <= le { Some ( * self ) } else { None } } else { None } } LineOrPoint :: Line ( p , q ) => { use geo :: algorithm :: line_intersection :: line_intersection ; line_intersection ( Line :: new ( p . coord ( ) , q . coord ( ) ) , line ) . map ( | l | match l { LineIntersection :: SinglePoint { intersection , .. } => intersection . into ( ) , LineIntersection :: Collinear { intersection } => intersection . into ( ) , } ) } } }
Intersect a line with self and return a point, a overlapping segment or `None`.
Intersect a line with self and return a point a overlapping segment or ` None ` .
&self
other
&Self
&self
other
&Self