Trait intersect2d::SelfIntersectingExclusive[][src]

pub trait SelfIntersectingExclusive<T> where
    T: Float + ToPrimitive + GeoFloat + CoordFloat + AbsDiffEq + UlpsEq,
    T::Epsilon: Copy
{ fn is_self_intersecting(&self) -> Result<bool, IntersectError>;
fn self_intersections<'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 excluded

Required methods

fn is_self_intersecting(&self) -> Result<bool, IntersectError>[src]

Returns true if any line intersects any other line in the collection.

fn self_intersections<'a>(
    &self
) -> Result<Box<dyn ExactSizeIterator<Item = (Coordinate<T>, Vec<usize>)> + 'a>, IntersectError> where
    T: 'a, 
[src]

Returns a list of intersection points and the involved lines, if any intersections are found.

Loading content...

Implementations on Foreign Types

impl<T> SelfIntersectingExclusive<T> for Vec<Line<T>> where
    T: Float + ToPrimitive + GeoFloat + CoordFloat + AbsDiffEq + UlpsEq,
    T::Epsilon: Copy
[src]

fn is_self_intersecting(&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().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().unwrap());

fn self_intersections<'a>(
    &self
) -> Result<Box<dyn ExactSizeIterator<Item = (Coordinate<T>, Vec<usize>)> + 'a>, IntersectError> where
    T: 'a, 
[src]

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();

let rv :Vec<(geo::Coordinate<_>,Vec<usize>)> =
    lines.self_intersections().expect("err").collect();
assert!(rv.is_empty());

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().expect("err").collect();

assert_eq!(rv.len(), 2);
assert_eq!(rv[0].1, vec!(0_usize, 2));
assert!(ulps_eq_c(&rv[0].0, &geo::Coordinate{x: 166.66666666666666, y: 100.0}));
assert_eq!(rv[1].1, vec!(0_usize, 3));
assert!(ulps_eq_c(&rv[1].0, &geo::Coordinate{x: 133.33333333333333, y: 100.0}));

impl<T> SelfIntersectingExclusive<T> for LineString<T> where
    T: Float + ToPrimitive + GeoFloat + CoordFloat + AbsDiffEq + UlpsEq,
    T::Epsilon: Copy
[src]

fn is_self_intersecting(&self) -> Result<bool, IntersectError>[src]

Returns true if the LineString is self intersecting. The ‘ignore_end_point_intersections’ parameter must always be set to true when testing LineStrings.


let line_string = geo::LineString::from(vec![
    (100., 100.),
    (200., 100.),
    (200., 200.),
    (100., 200.),
    (100., 100.),
]);
assert!(!line_string.is_self_intersecting().unwrap());

let line_string = geo::LineString::from(vec![
   (100., 100.),
   (200., 100.),
   (200., 200.),
   (150., 50.),
   (100., 200.),
   (100., 100.),
]);
assert!(line_string.is_self_intersecting().unwrap());

fn self_intersections<'a>(
    &self
) -> Result<Box<dyn ExactSizeIterator<Item = (Coordinate<T>, Vec<usize>)> + 'a>, IntersectError> where
    T: 'a, 
[src]

Returns an iterator containing the found intersections. The ‘ignore_end_point_intersections’ parameter must always be set to true when testing LineStrings.


let line_string = geo::LineString::from(vec![
    (100., 100.),
    (200., 100.),
    (200., 200.),
    (100., 200.),
    (100., 100.),
]);
let rv :Vec<(geo::Coordinate<_>,Vec<usize>)> =
    line_string.self_intersections().expect("err").collect();
assert!(rv.is_empty());

let line_string = geo::LineString::from(vec![
   (100., 100.),
   (200., 100.),
   (200., 200.),
   (150., 50.),
   (100., 200.),
   (100., 100.),
]);
let rv :Vec<(geo::Coordinate<_>,Vec<usize>)> =
    line_string.self_intersections().expect("err").collect();

assert_eq!(line_string.0.len(),6);
assert_eq!(rv.len(), 2);
assert_eq!(rv[0].1, vec!(0_usize,2));
assert!(ulps_eq_c(&rv[0].0, &geo::Coordinate{x: 166.66666666666666, y: 100.0}));
assert_eq!(rv[1].1, vec!(0_usize,3));
assert!(ulps_eq_c(&rv[1].0, &geo::Coordinate{x: 133.33333333333334, y: 100.0}));
Loading content...

Implementors

Loading content...