Expand description
§Geometry Rectangle Module
This module provides generic, N-dimensional rectangles and related utilities for geometric computations. It supports rectangles in arbitrary dimensions, with methods for construction, manipulation, cropping, intersection, and iteration.
§Features
- Generic
Rectangle<T, N>type for N-dimensional rectangles - Construction from position and size, or from two corner points
- Querying rectangle corners, edges, and center points
- Cropping and margin operations
- Intersection checks
- Iteration over rectangle indices (for integer types)
- Traits for rectangle-like types (
IRectangle,Crop)
§Usage
use hexga_math::prelude::*;
let rect = rect2i(0, 0, 10, 10);
assert!(rect.is_inside(point2(5, 5)));
let cropped = rect.crop_margin_intersect(point2(2, 2), point2(2, 2));
assert_eq!(cropped, rect2i(2, 2, 6, 6));§See Also
Vectorfor N-dimensional vector operationsGetRectangleandSetRectangletrait for rectangle-like abstractionsCroptrait for cropping operations
Modules§
Structs§
- Rectangle
Iter - Iter over all idx inside a rectangle
- Rectangle
Of - A
Ndimension rectangle
Traits§
- Crop
- Crop a selection to a sub selection, where the sub selection is contained in the selection.
- GetRectangle
- SetRectangle