Skip to main content

Module bounding

Module bounding 

Source
Expand description

Minimum bounding rectangle and computational geometry utilities

This module provides algorithms for computing:

  • Axis-aligned bounding boxes (AABB)
  • Minimum area bounding rectangles (using rotating calipers on convex hull)
  • Oriented bounding boxes
  • Polygon perimeter computation
  • Convex hull area and perimeter convenience functions

§Examples

use scirs2_spatial::computational_geometry::bounding::{
    axis_aligned_bounding_box, minimum_bounding_rectangle, polygon_perimeter,
};
use scirs2_core::ndarray::array;

let points = array![[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]];

let aabb = axis_aligned_bounding_box(&points.view()).expect("Operation failed");
let mbr = minimum_bounding_rectangle(&points.view()).expect("Operation failed");
let perim = polygon_perimeter(&points.view());

Structs§

AABB
An axis-aligned bounding box defined by its minimum and maximum coordinates
OrientedBoundingRect
An oriented bounding rectangle defined by center, axes, and half-extents

Functions§

axis_aligned_bounding_box
Compute the axis-aligned bounding box of a set of 2D points
convex_hull_area
Compute just the convex hull area for a point set
convex_hull_area_perimeter
Compute the area and perimeter of a convex hull given as a set of points
convex_hull_perimeter
Compute just the convex hull perimeter for a point set
is_convex
Determine if a polygon (given as ordered vertices) is convex
minimum_bounding_rectangle
Compute the minimum area bounding rectangle of a set of 2D points using the rotating calipers algorithm on the convex hull.
point_set_diameter
Compute the diameter of a point set (maximum distance between any two points)
point_set_width
Compute the width of a point set (minimum distance across)
polygon_perimeter
Compute the perimeter (circumference) of a polygon defined by ordered vertices
signed_polygon_area
Compute the signed area of a polygon (positive for CCW, negative for CW)