Trait geo::algorithm::intersects::Intersects [−][src]
pub trait Intersects<Rhs = Self> {
fn intersects(&self, rhs: &Rhs) -> bool;
}
Expand description
Checks if the geometry Self intersects the geometry Rhs.
More formally, either boundary or interior of Self has
non-empty (set-theoretic) intersection with the boundary
or interior of Rhs. In other words, the DE-9IM
intersection matrix for (Self, Rhs) is not FF*FF****
.
This predicate is symmetric: a.intersects(b)
iff
b.intersects(a)
.
Examples
use geo::algorithm::intersects::Intersects;
use geo::line_string;
let line_string_a = line_string![
(x: 3., y: 2.),
(x: 7., y: 6.),
];
let line_string_b = line_string![
(x: 3., y: 4.),
(x: 8., y: 4.),
];
let line_string_c = line_string![
(x: 9., y: 2.),
(x: 11., y: 5.),
];
assert!(line_string_a.intersects(&line_string_b));
assert!(!line_string_a.intersects(&line_string_c));