Trait geo::algorithm::contains::Contains [] [src]

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

Checks if the geometry A is completely inside the B geometry.

Required Methods

Checks if the geometry A is completely inside the B geometry.

use geo::{Coordinate, Point, LineString, Polygon};
use geo::algorithm::contains::Contains;

let p = |x, y| Point(Coordinate { x: x, y: y });
let v = Vec::new();
let linestring = LineString(vec![p(0., 0.), p(2., 0.), p(2., 2.), p(0., 2.), p(0., 0.)]);
let poly = Polygon::new(linestring.clone(), v);

//Point in Point
assert!(p(2., 0.).contains(&p(2., 0.)));

//Point in Linestring
assert!(linestring.contains(&p(2., 0.)));

//Point in Polygon
assert!(poly.contains(&p(1., 1.)));

Implementors