logo
pub trait Contains<Rhs = Self> {
    fn contains(&self, rhs: &Rhs) -> bool;
}
Expand description

Checks if rhs is completely contained within self. More formally, the interior of rhs has non-empty (set-theoretic) intersection but neither the interior, nor the boundary of rhs intersects the exterior of self. In other words, the DE-9IM intersection matrix of (rhs, self) is T*F**F***.

Examples

use geo::Contains;
use geo::{line_string, point, Polygon};

let line_string = line_string![
    (x: 0., y: 0.),
    (x: 2., y: 0.),
    (x: 2., y: 2.),
    (x: 0., y: 2.),
    (x: 0., y: 0.),
];

let polygon = Polygon::new(line_string.clone(), vec![]);

// Point in Point
assert!(point!(x: 2., y: 0.).contains(&point!(x: 2., y: 0.)));

// Point in Linestring
assert!(line_string.contains(&point!(x: 2., y: 0.)));

// Point in Polygon
assert!(polygon.contains(&point!(x: 1., y: 1.)));

Required Methods

Implementors