polygon_union

Function polygon_union 

Source
pub fn polygon_union(
    poly1: &ArrayView2<'_, f64>,
    poly2: &ArrayView2<'_, f64>,
) -> SpatialResult<Array2<f64>>
Expand description

Compute the union of two polygons

§Arguments

  • poly1 - First polygon vertices, shape (n, 2)
  • poly2 - Second polygon vertices, shape (m, 2)

§Returns

  • Array of union polygon vertices

§Examples

use scirs2_spatial::boolean_ops::polygon_union;
use scirs2_core::ndarray::array;

let poly1 = array![[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]];
let poly2 = array![[0.5, 0.5], [1.5, 0.5], [1.5, 1.5], [0.5, 1.5]];

let union = polygon_union(&poly1.view(), &poly2.view()).unwrap();