Skip to main content

RelationBetweenShapes

Trait RelationBetweenShapes 

Source
pub trait RelationBetweenShapes<Other: ?Sized> {
    // Required method
    fn relation(&self, other: &Other, relation: InputRelation) -> OutputRelation;

    // Provided methods
    fn all_relation(&self, other: &Other) -> OutputRelation { ... }
    fn any_relation(&self, other: &Other) -> OutputRelation { ... }
    fn contains(&self, other: &Other) -> bool { ... }
    fn strict_contains(&self, other: &Other) -> bool { ... }
    fn contained(&self, other: &Other) -> bool { ... }
    fn strict_contained(&self, other: &Other) -> bool { ... }
    fn intersects(&self, other: &Other) -> bool { ... }
    fn disjoint(&self, other: &Other) -> bool { ... }
}
Expand description

Lets you query the relation between two shapes.

Required Methods§

Source

fn relation(&self, other: &Other, relation: InputRelation) -> OutputRelation

Return the relation between two shapes. The InputRelation lets you specify the kind of relation you want to retrieve.

use zerometry::{Zoint, Zolygon, RelationBetweenShapes, InputRelation};

let point = geo_types::Point::new(0.0, 0.0); let polygon = geo_types::polygon![(x: -1.0, y: -1.0), (x: 1.0, y: -1.0), (x: 1.0, y: 1.0), (x: -1.0, y: 1.0)];

let mut buffer = Vec::new(); Zoint::write_from_geometry(&mut buffer, &point).unwrap(); let zoint = Zoint::from_bytes(&buffer); let mut buffer = Vec::new(); Zoint::write_from_geometry(&mut buffer, &polygon).unwrap(); let zolygon = Zolygon::from_bytes(&buffer);

// Let’s say we just want to know if the point is contained in the polygon, // we could write let relation = InputRelation { contains: true, ..InputRelation::default() }; // The we can ask the relation between our two shape with the relation method: let relation = zolygon.relation(&zoint, relation); assert_eq!(relation.contains, Some(true));

Provided Methods§

Source

fn all_relation(&self, other: &Other) -> OutputRelation

Return all relations with no early return.

Source

fn any_relation(&self, other: &Other) -> OutputRelation

Return the first relation we find with early return.

Source

fn contains(&self, other: &Other) -> bool

Return true if Self contains Other.

Source

fn strict_contains(&self, other: &Other) -> bool

Return true if Self strictly contains Other.

Source

fn contained(&self, other: &Other) -> bool

Return true if Self is contained in Other.

Source

fn strict_contained(&self, other: &Other) -> bool

Return true if Self is strictly contained in Other.

Source

fn intersects(&self, other: &Other) -> bool

Return true if Self intersects with Other.

Source

fn disjoint(&self, other: &Other) -> bool

Return true if Self is disjoint of Other.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a> RelationBetweenShapes<Zerometry<'a>> for Geometry<f64>

Source§

fn relation( &self, other: &Zerometry<'a>, relation: InputRelation, ) -> OutputRelation

Source§

impl<'a> RelationBetweenShapes<Zolygon<'a>> for Polygon<f64>

Source§

fn relation( &self, other: &Zolygon<'a>, relation: InputRelation, ) -> OutputRelation

Implementors§

Source§

impl RelationBetweenShapes<BoundingBox> for BoundingBox

Source§

impl RelationBetweenShapes<Coord> for BoundingBox

Source§

impl<'a> RelationBetweenShapes<Coord> for Zolygon<'a>

Source§

impl<'a> RelationBetweenShapes<Geometry> for Zerometry<'a>

Source§

impl<'a> RelationBetweenShapes<MultiPolygon> for Zerometry<'a>

Source§

impl<'a> RelationBetweenShapes<MultiPolygon> for Zolygon<'a>

Source§

impl<'a> RelationBetweenShapes<Polygon> for Zerometry<'a>

Source§

impl<'a> RelationBetweenShapes<Polygon> for Zolygon<'a>

Source§

impl<'a> RelationBetweenShapes<Zerometry<'a>> for Zerometry<'a>

Source§

impl<'a> RelationBetweenShapes<Zerometry<'a>> for Zine<'a>

Source§

impl<'a> RelationBetweenShapes<Zerometry<'a>> for Zoint<'a>

Source§

impl<'a> RelationBetweenShapes<Zerometry<'a>> for Zollection<'a>

Source§

impl<'a> RelationBetweenShapes<Zerometry<'a>> for Zolygon<'a>

Source§

impl<'a> RelationBetweenShapes<Zerometry<'a>> for ZultiLines<'a>

Source§

impl<'a> RelationBetweenShapes<Zerometry<'a>> for ZultiPoints<'a>

Source§

impl<'a> RelationBetweenShapes<Zerometry<'a>> for ZultiPolygons<'a>

Source§

impl<'a> RelationBetweenShapes<Zine<'a>> for Zerometry<'a>

Source§

impl<'a> RelationBetweenShapes<Zine<'a>> for Zine<'a>

Source§

impl<'a> RelationBetweenShapes<Zine<'a>> for Zoint<'a>

Source§

impl<'a> RelationBetweenShapes<Zine<'a>> for Zollection<'a>

Source§

impl<'a> RelationBetweenShapes<Zine<'a>> for Zolygon<'a>

Source§

impl<'a> RelationBetweenShapes<Zine<'a>> for ZultiLines<'a>

Source§

impl<'a> RelationBetweenShapes<Zine<'a>> for ZultiPoints<'a>

Source§

impl<'a> RelationBetweenShapes<Zine<'a>> for ZultiPolygons<'a>

Source§

impl<'a> RelationBetweenShapes<Zoint<'a>> for Zerometry<'a>

Source§

impl<'a> RelationBetweenShapes<Zoint<'a>> for Zine<'a>

Source§

impl<'a> RelationBetweenShapes<Zoint<'a>> for Zoint<'a>

Source§

impl<'a> RelationBetweenShapes<Zoint<'a>> for Zollection<'a>

Source§

impl<'a> RelationBetweenShapes<Zoint<'a>> for Zolygon<'a>

Source§

impl<'a> RelationBetweenShapes<Zoint<'a>> for ZultiLines<'a>

Source§

impl<'a> RelationBetweenShapes<Zoint<'a>> for ZultiPoints<'a>

Source§

impl<'a> RelationBetweenShapes<Zoint<'a>> for ZultiPolygons<'a>

Source§

impl<'a> RelationBetweenShapes<Zollection<'a>> for Zerometry<'a>

Source§

impl<'a> RelationBetweenShapes<Zollection<'a>> for Zine<'a>

Source§

impl<'a> RelationBetweenShapes<Zollection<'a>> for Zoint<'a>

Source§

impl<'a> RelationBetweenShapes<Zollection<'a>> for Zollection<'a>

Source§

impl<'a> RelationBetweenShapes<Zollection<'a>> for Zolygon<'a>

Source§

impl<'a> RelationBetweenShapes<Zollection<'a>> for ZultiLines<'a>

Source§

impl<'a> RelationBetweenShapes<Zollection<'a>> for ZultiPoints<'a>

Source§

impl<'a> RelationBetweenShapes<Zollection<'a>> for ZultiPolygons<'a>

Source§

impl<'a> RelationBetweenShapes<Zolygon<'a>> for Zerometry<'a>

Source§

impl<'a> RelationBetweenShapes<Zolygon<'a>> for Zine<'a>

Source§

impl<'a> RelationBetweenShapes<Zolygon<'a>> for Zoint<'a>

Source§

impl<'a> RelationBetweenShapes<Zolygon<'a>> for Zollection<'a>

Source§

impl<'a> RelationBetweenShapes<Zolygon<'a>> for Zolygon<'a>

Source§

impl<'a> RelationBetweenShapes<Zolygon<'a>> for ZultiLines<'a>

Source§

impl<'a> RelationBetweenShapes<Zolygon<'a>> for ZultiPoints<'a>

Source§

impl<'a> RelationBetweenShapes<Zolygon<'a>> for ZultiPolygons<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiLines<'a>> for Zerometry<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiLines<'a>> for Zine<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiLines<'a>> for Zoint<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiLines<'a>> for Zollection<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiLines<'a>> for Zolygon<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiLines<'a>> for ZultiLines<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiLines<'a>> for ZultiPoints<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiLines<'a>> for ZultiPolygons<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiPoints<'a>> for Zerometry<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiPoints<'a>> for Zine<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiPoints<'a>> for Zoint<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiPoints<'a>> for Zollection<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiPoints<'a>> for Zolygon<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiPoints<'a>> for ZultiLines<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiPoints<'a>> for ZultiPoints<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiPoints<'a>> for ZultiPolygons<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiPolygons<'a>> for Zerometry<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiPolygons<'a>> for Zine<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiPolygons<'a>> for Zoint<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiPolygons<'a>> for Zollection<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiPolygons<'a>> for Zolygon<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiPolygons<'a>> for ZultiLines<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiPolygons<'a>> for ZultiPoints<'a>

Source§

impl<'a> RelationBetweenShapes<ZultiPolygons<'a>> for ZultiPolygons<'a>