pub trait BooleanOp<T: CoordinateType> {
    // Required method
    fn boolean_op(
        &self,
        operation: Operation,
        other: &Self,
        polygon_semantics: PolygonSemantics
    ) -> MultiPolygon<T>;

    // Provided methods
    fn intersection(&self, other: &Self) -> MultiPolygon<T> { ... }
    fn difference(&self, other: &Self) -> MultiPolygon<T> { ... }
    fn union(&self, other: &Self) -> MultiPolygon<T> { ... }
    fn xor(&self, other: &Self) -> MultiPolygon<T> { ... }
}
Expand description

Trait for geometric primitives that support boolean operations.

Required Methods§

source

fn boolean_op( &self, operation: Operation, other: &Self, polygon_semantics: PolygonSemantics ) -> MultiPolygon<T>

Compute the boolean operation of self and other.

Parameters
  • operation: The type of boolean operation to be computed (intersection, union, difference, XOR).
  • other: The other operand. A geometric object of the same type as self.
  • polygon_semantics: Define the ‘inside’ of a polygon. In case of doubt Union-semantics could be a good choice.

Provided Methods§

source

fn intersection(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean intersection self & other.

Union semantics are used for self-overlapping polygons.

source

fn difference(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean difference self - other.

Union semantics are used for self-overlapping polygons.

source

fn union(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean union self | other.

Union semantics are used for self-overlapping polygons.

source

fn xor(&self, other: &Self) -> MultiPolygon<T>

Compute the boolean exclusive OR self ^ other.

Union semantics are used for self-overlapping polygons.

Implementations on Foreign Types§

source§

impl BooleanOp<i32> for Polygon<i32>

source§

fn boolean_op( &self, operation: Operation, other: &Self, polygon_semantics: PolygonSemantics ) -> MultiPolygon<i32>

source§

impl BooleanOp<Ratio<i64>> for Polygon<Rational64>

source§

fn boolean_op( &self, operation: Operation, other: &Self, polygon_semantics: PolygonSemantics ) -> MultiPolygon<Rational64>

source§

impl BooleanOp<Ratio<i64>> for MultiPolygon<Rational64>

source§

fn boolean_op( &self, operation: Operation, other: &Self, polygon_semantics: PolygonSemantics ) -> MultiPolygon<Rational64>

source§

impl BooleanOp<f32> for Polygon<f32>

source§

fn boolean_op( &self, operation: Operation, other: &Self, polygon_semantics: PolygonSemantics ) -> MultiPolygon<f32>

source§

impl BooleanOp<f64> for MultiPolygon<f64>

source§

fn boolean_op( &self, operation: Operation, other: &Self, polygon_semantics: PolygonSemantics ) -> MultiPolygon<f64>

source§

impl BooleanOp<f32> for MultiPolygon<f32>

source§

fn boolean_op( &self, operation: Operation, other: &Self, polygon_semantics: PolygonSemantics ) -> MultiPolygon<f32>

source§

impl BooleanOp<i64> for MultiPolygon<i64>

source§

fn boolean_op( &self, operation: Operation, other: &Self, polygon_semantics: PolygonSemantics ) -> MultiPolygon<i64>

source§

impl BooleanOp<i32> for MultiPolygon<i32>

source§

fn boolean_op( &self, operation: Operation, other: &Self, polygon_semantics: PolygonSemantics ) -> MultiPolygon<i32>

source§

impl BooleanOp<i64> for Polygon<i64>

source§

fn boolean_op( &self, operation: Operation, other: &Self, polygon_semantics: PolygonSemantics ) -> MultiPolygon<i64>

source§

impl BooleanOp<Ratio<i32>> for Polygon<Rational32>

source§

fn boolean_op( &self, operation: Operation, other: &Self, polygon_semantics: PolygonSemantics ) -> MultiPolygon<Rational32>

source§

impl BooleanOp<f64> for Polygon<f64>

source§

fn boolean_op( &self, operation: Operation, other: &Self, polygon_semantics: PolygonSemantics ) -> MultiPolygon<f64>

source§

impl BooleanOp<Ratio<i32>> for MultiPolygon<Rational32>

source§

fn boolean_op( &self, operation: Operation, other: &Self, polygon_semantics: PolygonSemantics ) -> MultiPolygon<Rational32>

Implementors§