Trait intersect2d::SelfIntersectingInclusive [−][src]
pub trait SelfIntersectingInclusive<T> where
T: Float + ToPrimitive + GeoFloat + CoordFloat + AbsDiffEq + UlpsEq,
T::Epsilon: Copy, { fn is_self_intersecting_inclusive(&self) -> Result<bool, IntersectError>; fn self_intersections_inclusive<'a>(
&self
) -> Result<Box<dyn ExactSizeIterator<Item = (Coordinate<T>, Vec<usize>)> + 'a>, IntersectError>
where
T: 'a; }
Trait for self intersection tests where the end points are included
Required methods
fn is_self_intersecting_inclusive(&self) -> Result<bool, IntersectError>
[src]
Returns true if any line intersects any other line in the collection. If the end points are identical they will be reported too.
fn self_intersections_inclusive<'a>(
&self
) -> Result<Box<dyn ExactSizeIterator<Item = (Coordinate<T>, Vec<usize>)> + 'a>, IntersectError> where
T: 'a,
[src]
&self
) -> Result<Box<dyn ExactSizeIterator<Item = (Coordinate<T>, Vec<usize>)> + 'a>, IntersectError> where
T: 'a,
Returns a list of intersection points and the involved lines, if any intersections are found. If the end points are identical they will be reported too.
Implementations on Foreign Types
impl<T> SelfIntersectingInclusive<T> for Vec<Line<T>> where
T: Float + ToPrimitive + GeoFloat + CoordFloat + AbsDiffEq + UlpsEq,
T::Epsilon: Copy,
[src]
impl<T> SelfIntersectingInclusive<T> for Vec<Line<T>> where
T: Float + ToPrimitive + GeoFloat + CoordFloat + AbsDiffEq + UlpsEq,
T::Epsilon: Copy,
[src]fn is_self_intersecting_inclusive(&self) -> Result<bool, IntersectError>
[src]
Returns true if the LineString is self intersecting. LineStrings.
let lines: Vec<geo::Line<_>> = geo::LineString::from(vec![ (100., 100.), (200., 100.), (200., 200.), (100., 200.), (100., 100.), ]).lines().collect(); assert!(lines.is_self_intersecting_inclusive().unwrap()); let lines: Vec<geo::Line<_>> = geo::LineString::from(vec![ (100., 100.), (200., 100.), (200., 200.), (150., 50.), (100., 200.), (100., 100.), ]).lines().collect(); assert!(lines.is_self_intersecting_inclusive().unwrap());
fn self_intersections_inclusive<'a>(
&self
) -> Result<Box<dyn ExactSizeIterator<Item = (Coordinate<T>, Vec<usize>)> + 'a>, IntersectError> where
T: 'a,
[src]
&self
) -> Result<Box<dyn ExactSizeIterator<Item = (Coordinate<T>, Vec<usize>)> + 'a>, IntersectError> where
T: 'a,
Returns an iterator containing the found intersections.
let lines : Vec<geo::Line<_>>= geo::LineString::from(vec![ (100., 100.), (200., 100.), (200., 200.), (100., 200.), (100., 100.), ]).lines().collect(); assert!(!lines.self_intersections_inclusive().expect("err").count()>0); let lines : Vec<geo::Line<_>> = geo::LineString::from(vec![ (100., 100.), (200., 100.), (200., 200.), (150., 50.), (100., 200.), (100., 100.), ]).lines().collect(); let rv :Vec<(geo::Coordinate<_>,Vec<usize>)> = lines.self_intersections_inclusive().expect("err").collect(); for f in rv.iter() { println!("{:?}", f); } assert_eq!(rv.len(), 7); assert!(ulps_eq_c(&rv[0].0, &geo::Coordinate{x: 200., y: 100.0})); assert_eq!(rv[0].1, vec!(0_usize, 1)); assert!(ulps_eq_c(&rv[1].0, &geo::Coordinate{x: 166.66666666666666, y: 100.0})); assert_eq!(rv[1].1, vec!(0_usize, 2)); assert!(ulps_eq_c(&rv[2].0, &geo::Coordinate{x: 133.33333333333333, y: 100.0})); assert_eq!(rv[2].1, vec!(0_usize, 3)); assert!(ulps_eq_c(&rv[3].0, &geo::Coordinate{x: 100., y: 100.0})); assert_eq!(rv[3].1, vec!(0_usize, 4)); // and more...