math-geometry-2d
Shared 2D geometry contracts for multimodal image, video, and layout processing. This crate is part of the Analytical Math Crates family.
Highlights
- Checked pixel and normalized 2D primitives
- Rectangle intersection, union, and clamping helpers
- Rectangle IoU and directional overlap ratios
- Finite line-segment intersection parameters
- Affine transforms with compose and invert support
- Polygon area, centroid, winding, containment, and bounds helpers
- Normalized and pixel coordinate conversion helpers
Example
use ;
Package surface
Primary workflow: geometry.bounds.
Workflow operations:
geometry.bounds: Computes 2D bounds, dimensions, and center for finite points.geometry.transform: Applies an affine transform to finite 2D points and returns transformed bounds.geometry.intersections: Checks every rectangle pair and returns intersection rectangles when present.geometry.overlap: Computes intersection area, IoU, and directional overlap ratios for two rectangles.geometry.segmentIntersection: Computes the point and segment parameters for two finite 2D segment intersections.geometry.polygonSummary: Reports area, winding, centroid, and bounds for a finite 2D polygon.
Debug operations:
describe: inspect package metadata and runtime support.
Runtime support: library, CLI, server, and WASM wrappers expose these operations.
Run the primary workflow through the CLI:
Successful responses use the shared package-surface shape with operation,
title, message, summary, and result. Default surface calls are
deterministic, local-first, and do not download models, write persistent files,
or execute external tools unless an operation explicitly documents native or
external-tool execution.
Related crates
video-analysis-coreimage-analysis-processingvideo-analysis-posture