pub struct RegionBounds {
pub min_x: f64,
pub max_x: f64,
pub min_y: f64,
pub max_y: f64,
pub min_z: f64,
pub max_z: f64,
}Expand description
Defines the spatial boundaries of a game region.
This structure defines a 3D axis-aligned bounding box (AABB) that encompasses all the space within a game region. Compatible with both Horizon and Atlas.
Fields§
§min_x: f64Minimum X coordinate (western boundary)
max_x: f64Maximum X coordinate (eastern boundary)
min_y: f64Minimum Y coordinate (bottom boundary)
max_y: f64Maximum Y coordinate (top boundary)
min_z: f64Minimum Z coordinate (southern boundary)
max_z: f64Maximum Z coordinate (northern boundary)
Implementations§
Source§impl RegionBounds
impl RegionBounds
Sourcepub fn new(
min_x: f64,
max_x: f64,
min_y: f64,
max_y: f64,
min_z: f64,
max_z: f64,
) -> Self
pub fn new( min_x: f64, max_x: f64, min_y: f64, max_y: f64, min_z: f64, max_z: f64, ) -> Self
Creates a new region bounds from min/max values.
Sourcepub fn from_center(center: WorldCoordinate, half_extent: f64) -> Self
pub fn from_center(center: WorldCoordinate, half_extent: f64) -> Self
Creates region bounds from center point and half-extents.
Sourcepub fn center(&self) -> WorldCoordinate
pub fn center(&self) -> WorldCoordinate
Get the center point of this region.
Sourcepub fn half_extent(&self) -> f64
pub fn half_extent(&self) -> f64
Get the half-extent (assuming cubic region).
Sourcepub fn contains(&self, coord: &WorldCoordinate) -> bool
pub fn contains(&self, coord: &WorldCoordinate) -> bool
Check if a world coordinate is within these bounds.
Sourcepub fn distance_to_boundary(&self, coord: &WorldCoordinate) -> f64
pub fn distance_to_boundary(&self, coord: &WorldCoordinate) -> f64
Calculate the distance from a point to the nearest boundary. Returns negative if inside, positive if outside.
Sourcepub fn overlaps(&self, other: &RegionBounds) -> bool
pub fn overlaps(&self, other: &RegionBounds) -> bool
Check if this region overlaps with another.
Trait Implementations§
Source§impl Clone for RegionBounds
impl Clone for RegionBounds
Source§fn clone(&self) -> RegionBounds
fn clone(&self) -> RegionBounds
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more