pub fn difference_polygon_pooled(
subject: &Polygon,
clip: &Polygon,
) -> Result<PoolGuard<'static, Polygon>>Expand description
Computes difference of two polygons using object pooling
This is the pooled version of difference_polygon that reuses allocated
polygons from a thread-local pool. Returns the first result polygon.
§Arguments
subject- Polygon to subtract fromclip- Polygon to subtract
§Returns
A pooled polygon guard representing the difference (first result if multiple)
§Errors
Returns error if polygons are invalid
§Example
use oxigdal_algorithms::vector::{difference_polygon_pooled, Coordinate, LineString, Polygon};
let coords1 = vec![
Coordinate::new_2d(0.0, 0.0),
Coordinate::new_2d(10.0, 0.0),
Coordinate::new_2d(10.0, 10.0),
Coordinate::new_2d(0.0, 10.0),
Coordinate::new_2d(0.0, 0.0),
];
let ext1 = LineString::new(coords1)?;
let poly1 = Polygon::new(ext1, vec![])?;
let result = difference_polygon_pooled(&poly1, &poly2)?;