Skip to main content

envelope

Function envelope 

Source
pub fn envelope(geometry: &Geometry) -> Result<Polygon>
Expand description

Computes the envelope of any geometry type

Returns a rectangular polygon that represents the axis-aligned bounding box of the input geometry.

§Arguments

  • geometry - Input geometry

§Returns

Polygon representing the envelope (bounding box)

§Errors

Returns error if geometry is empty or invalid

§Examples

use oxigdal_core::vector::Geometry;
use oxigdal_algorithms::vector::{Point, envelope};

let point = Point::new(3.0, 5.0);
let geom = Geometry::Point(point);
let env = envelope(&geom)?;
// For a point, envelope is a degenerate rectangle at that point