Trait geo::algorithm::relate::Relate

source ·
pub trait Relate<F, T> {
    // Required method
    fn relate(&self, other: &T) -> IntersectionMatrix;
}
Expand description

Topologically relate two geometries based on DE-9IM semantics.

See IntersectionMatrix for details. All predicates are available on the calculated matrix.

§Examples

use geo::{coord, Line, Rect, line_string};
use crate::geo::relate::Relate;

let line = Line::new(coord! { x: 2.0, y: 2.0}, coord! { x: 4.0, y: 4.0 });
let rect = Rect::new(coord! { x: 2.0, y: 2.0}, coord! { x: 4.0, y: 4.0 });
let intersection_matrix = rect.relate(&line);

assert!(intersection_matrix.is_intersects());
assert!(!intersection_matrix.is_disjoint());
assert!(intersection_matrix.is_contains());
assert!(!intersection_matrix.is_within());

let line = Line::new(coord! { x: 1.0, y: 1.0}, coord! { x: 5.0, y: 5.0 });
let rect = Rect::new(coord! { x: 2.0, y: 2.0}, coord! { x: 4.0, y: 4.0 });
let intersection_matrix = rect.relate(&line);
assert!(intersection_matrix.is_intersects());
assert!(!intersection_matrix.is_disjoint());
assert!(!intersection_matrix.is_contains());
assert!(!intersection_matrix.is_within());

let rect_boundary = line_string![
    (x: 2.0, y: 2.0),
    (x: 4.0, y: 2.0),
    (x: 4.0, y: 4.0),
    (x: 2.0, y: 4.0),
    (x: 2.0, y: 2.0)
];
let intersection_matrix = rect.relate(&rect_boundary);
assert!(intersection_matrix.is_intersects());
assert!(!intersection_matrix.is_disjoint());
// According to DE-9IM, polygons don't contain their own boundary
assert!(!intersection_matrix.is_contains());
assert!(!intersection_matrix.is_within());

Note: Relate must not be called on geometries containing NaN coordinates.

Required Methods§

source

fn relate(&self, other: &T) -> IntersectionMatrix

Implementors§

source§

impl<F: GeoFloat> Relate<F, Geometry<F>> for Geometry<F>

source§

impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for GeometryCollection<F>

source§

impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for Line<F>

source§

impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for LineString<F>

source§

impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for MultiLineString<F>

source§

impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for MultiPoint<F>

source§

impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for MultiPolygon<F>

source§

impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for Point<F>

source§

impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for Polygon<F>

source§

impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for Rect<F>

source§

impl<F: GeoFloat> Relate<F, GeometryCollection<F>> for Triangle<F>

source§

impl<F: GeoFloat> Relate<F, Line<F>> for GeometryCollection<F>

source§

impl<F: GeoFloat> Relate<F, Line<F>> for Line<F>

source§

impl<F: GeoFloat> Relate<F, Line<F>> for LineString<F>

source§

impl<F: GeoFloat> Relate<F, Line<F>> for MultiLineString<F>

source§

impl<F: GeoFloat> Relate<F, Line<F>> for MultiPoint<F>

source§

impl<F: GeoFloat> Relate<F, Line<F>> for MultiPolygon<F>

source§

impl<F: GeoFloat> Relate<F, Line<F>> for Point<F>

source§

impl<F: GeoFloat> Relate<F, Line<F>> for Polygon<F>

source§

impl<F: GeoFloat> Relate<F, Line<F>> for Rect<F>

source§

impl<F: GeoFloat> Relate<F, Line<F>> for Triangle<F>

source§

impl<F: GeoFloat> Relate<F, LineString<F>> for GeometryCollection<F>

source§

impl<F: GeoFloat> Relate<F, LineString<F>> for Line<F>

source§

impl<F: GeoFloat> Relate<F, LineString<F>> for LineString<F>

source§

impl<F: GeoFloat> Relate<F, LineString<F>> for MultiLineString<F>

source§

impl<F: GeoFloat> Relate<F, LineString<F>> for MultiPoint<F>

source§

impl<F: GeoFloat> Relate<F, LineString<F>> for MultiPolygon<F>

source§

impl<F: GeoFloat> Relate<F, LineString<F>> for Point<F>

source§

impl<F: GeoFloat> Relate<F, LineString<F>> for Polygon<F>

source§

impl<F: GeoFloat> Relate<F, LineString<F>> for Rect<F>

source§

impl<F: GeoFloat> Relate<F, LineString<F>> for Triangle<F>

source§

impl<F: GeoFloat> Relate<F, MultiLineString<F>> for GeometryCollection<F>

source§

impl<F: GeoFloat> Relate<F, MultiLineString<F>> for Line<F>

source§

impl<F: GeoFloat> Relate<F, MultiLineString<F>> for LineString<F>

source§

impl<F: GeoFloat> Relate<F, MultiLineString<F>> for MultiLineString<F>

source§

impl<F: GeoFloat> Relate<F, MultiLineString<F>> for MultiPoint<F>

source§

impl<F: GeoFloat> Relate<F, MultiLineString<F>> for MultiPolygon<F>

source§

impl<F: GeoFloat> Relate<F, MultiLineString<F>> for Point<F>

source§

impl<F: GeoFloat> Relate<F, MultiLineString<F>> for Polygon<F>

source§

impl<F: GeoFloat> Relate<F, MultiLineString<F>> for Rect<F>

source§

impl<F: GeoFloat> Relate<F, MultiLineString<F>> for Triangle<F>

source§

impl<F: GeoFloat> Relate<F, MultiPoint<F>> for GeometryCollection<F>

source§

impl<F: GeoFloat> Relate<F, MultiPoint<F>> for Line<F>

source§

impl<F: GeoFloat> Relate<F, MultiPoint<F>> for LineString<F>

source§

impl<F: GeoFloat> Relate<F, MultiPoint<F>> for MultiLineString<F>

source§

impl<F: GeoFloat> Relate<F, MultiPoint<F>> for MultiPoint<F>

source§

impl<F: GeoFloat> Relate<F, MultiPoint<F>> for MultiPolygon<F>

source§

impl<F: GeoFloat> Relate<F, MultiPoint<F>> for Point<F>

source§

impl<F: GeoFloat> Relate<F, MultiPoint<F>> for Polygon<F>

source§

impl<F: GeoFloat> Relate<F, MultiPoint<F>> for Rect<F>

source§

impl<F: GeoFloat> Relate<F, MultiPoint<F>> for Triangle<F>

source§

impl<F: GeoFloat> Relate<F, MultiPolygon<F>> for GeometryCollection<F>

source§

impl<F: GeoFloat> Relate<F, MultiPolygon<F>> for Line<F>

source§

impl<F: GeoFloat> Relate<F, MultiPolygon<F>> for LineString<F>

source§

impl<F: GeoFloat> Relate<F, MultiPolygon<F>> for MultiLineString<F>

source§

impl<F: GeoFloat> Relate<F, MultiPolygon<F>> for MultiPoint<F>

source§

impl<F: GeoFloat> Relate<F, MultiPolygon<F>> for MultiPolygon<F>

source§

impl<F: GeoFloat> Relate<F, MultiPolygon<F>> for Point<F>

source§

impl<F: GeoFloat> Relate<F, MultiPolygon<F>> for Polygon<F>

source§

impl<F: GeoFloat> Relate<F, MultiPolygon<F>> for Rect<F>

source§

impl<F: GeoFloat> Relate<F, MultiPolygon<F>> for Triangle<F>

source§

impl<F: GeoFloat> Relate<F, Point<F>> for GeometryCollection<F>

source§

impl<F: GeoFloat> Relate<F, Point<F>> for Line<F>

source§

impl<F: GeoFloat> Relate<F, Point<F>> for LineString<F>

source§

impl<F: GeoFloat> Relate<F, Point<F>> for MultiLineString<F>

source§

impl<F: GeoFloat> Relate<F, Point<F>> for MultiPoint<F>

source§

impl<F: GeoFloat> Relate<F, Point<F>> for MultiPolygon<F>

source§

impl<F: GeoFloat> Relate<F, Point<F>> for Point<F>

source§

impl<F: GeoFloat> Relate<F, Point<F>> for Polygon<F>

source§

impl<F: GeoFloat> Relate<F, Point<F>> for Rect<F>

source§

impl<F: GeoFloat> Relate<F, Point<F>> for Triangle<F>

source§

impl<F: GeoFloat> Relate<F, Polygon<F>> for GeometryCollection<F>

source§

impl<F: GeoFloat> Relate<F, Polygon<F>> for Line<F>

source§

impl<F: GeoFloat> Relate<F, Polygon<F>> for LineString<F>

source§

impl<F: GeoFloat> Relate<F, Polygon<F>> for MultiLineString<F>

source§

impl<F: GeoFloat> Relate<F, Polygon<F>> for MultiPoint<F>

source§

impl<F: GeoFloat> Relate<F, Polygon<F>> for MultiPolygon<F>

source§

impl<F: GeoFloat> Relate<F, Polygon<F>> for Point<F>

source§

impl<F: GeoFloat> Relate<F, Polygon<F>> for Polygon<F>

source§

impl<F: GeoFloat> Relate<F, Polygon<F>> for Rect<F>

source§

impl<F: GeoFloat> Relate<F, Polygon<F>> for Triangle<F>

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for GeometryCollection<F>

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for Line<F>

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for LineString<F>

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for MultiLineString<F>

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for MultiPoint<F>

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for MultiPolygon<F>

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for Point<F>

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for Polygon<F>

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for Rect<F>

source§

impl<F: GeoFloat> Relate<F, Rect<F>> for Triangle<F>

source§

impl<F: GeoFloat> Relate<F, Triangle<F>> for GeometryCollection<F>

source§

impl<F: GeoFloat> Relate<F, Triangle<F>> for Line<F>

source§

impl<F: GeoFloat> Relate<F, Triangle<F>> for LineString<F>

source§

impl<F: GeoFloat> Relate<F, Triangle<F>> for MultiLineString<F>

source§

impl<F: GeoFloat> Relate<F, Triangle<F>> for MultiPoint<F>

source§

impl<F: GeoFloat> Relate<F, Triangle<F>> for MultiPolygon<F>

source§

impl<F: GeoFloat> Relate<F, Triangle<F>> for Point<F>

source§

impl<F: GeoFloat> Relate<F, Triangle<F>> for Polygon<F>

source§

impl<F: GeoFloat> Relate<F, Triangle<F>> for Rect<F>

source§

impl<F: GeoFloat> Relate<F, Triangle<F>> for Triangle<F>