pub struct WorldBounds {
pub min: WorldCoord,
pub max: WorldCoord,
}Expand description
An axis-aligned bounding box in projected world space (meters).
The coordinate system matches WorldCoord: right-handed Z-up,
X east, Y north, Z up.
min contains the component-wise minimum and max the component-wise
maximum. For 2D tile operations min.z and max.z are typically 0.
§Construction
| Method | Description |
|---|---|
new | From explicit min/max corners |
from_min_max | Alias for new |
§Display
Formats as "WorldBounds(min: ..., max: ...)".
Fields§
§min: WorldCoordComponent-wise minimum corner (south-west-bottom).
max: WorldCoordComponent-wise maximum corner (north-east-top).
Implementations§
Source§impl WorldBounds
impl WorldBounds
Sourcepub fn new(min: WorldCoord, max: WorldCoord) -> Self
pub fn new(min: WorldCoord, max: WorldCoord) -> Self
Create a world-space bounding box from explicit min/max corners.
Sourcepub fn from_min_max(min: WorldCoord, max: WorldCoord) -> Self
pub fn from_min_max(min: WorldCoord, max: WorldCoord) -> Self
Alias for new.
Sourcepub fn center(&self) -> WorldCoord
pub fn center(&self) -> WorldCoord
Center point of the bounding box.
Sourcepub fn contains_point(&self, point: &WorldCoord) -> bool
pub fn contains_point(&self, point: &WorldCoord) -> bool
Whether a world-space point is inside the bounding box (inclusive).
Sourcepub fn intersects(&self, other: &WorldBounds) -> bool
pub fn intersects(&self, other: &WorldBounds) -> bool
Whether two world-space bounding boxes overlap (inclusive).
Sourcepub fn extend(&mut self, other: &WorldBounds)
pub fn extend(&mut self, other: &WorldBounds)
Extend the bounds to include another bounding box.
Sourcepub fn extend_point(&mut self, point: &WorldCoord)
pub fn extend_point(&mut self, point: &WorldCoord)
Extend the bounds to include a single world-space point.
Trait Implementations§
Source§impl Clone for WorldBounds
impl Clone for WorldBounds
Source§fn clone(&self) -> WorldBounds
fn clone(&self) -> WorldBounds
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more