pub struct NdsBoundingBox {
pub min_x: i32,
pub min_y: i32,
pub max_x: i32,
pub max_y: i32,
}Expand description
Axis-aligned bounding box in NDS coordinates (32-bit integers).
min_x/max_x: longitude (32-bit signed)min_y/max_y: latitude (31-bit signed)
Fields§
§min_x: i32SW corner longitude (NDS coords).
min_y: i32SW corner latitude (NDS coords).
max_x: i32NE corner longitude (NDS coords).
max_y: i32NE corner latitude (NDS coords).
Implementations§
Source§impl NdsBoundingBox
impl NdsBoundingBox
Sourcepub fn new(min_x: i32, min_y: i32, max_x: i32, max_y: i32) -> Self
pub fn new(min_x: i32, min_y: i32, max_x: i32, max_y: i32) -> Self
Construct a bounding box from explicit corner coordinates.
Sourcepub fn intersects(&self, other: &NdsBoundingBox) -> bool
pub fn intersects(&self, other: &NdsBoundingBox) -> bool
Check whether this bounding box intersects (overlaps) other.
Boundaries are inclusive: touching edges count as intersecting, matching the Python reference.
Sourcepub fn contains(&self, other: &NdsBoundingBox) -> bool
pub fn contains(&self, other: &NdsBoundingBox) -> bool
Check whether this bounding box fully contains other.
Sourcepub fn from_tile(tile: &PackedTileId) -> Self
pub fn from_tile(tile: &PackedTileId) -> Self
Create a bounding box covering a tile’s area.
Uses the tile’s (exclusive) NE corner directly, matching the Python
from_tile.
Note: NDS coordinates are 32-bit; for very large tiles (e.g. a level-0
tile whose exclusive NE corner is 2^31) the corner does not fit in a
signed i32 and wraps. The Python reference uses unbounded integers, so
this is the one place the fixed-width Rust port can differ at the extreme
boundary. All other corners (level >= 1, or any tile not touching the
antimeridian / pole) are representable exactly.
Sourcepub fn from_wgs84_corners(sw: &Wgs84, ne: &Wgs84) -> Self
pub fn from_wgs84_corners(sw: &Wgs84, ne: &Wgs84) -> Self
Create a bounding box from WGS84 corner coordinates.
sw is the south-west (min lon/lat) corner, ne the north-east corner.
Trait Implementations§
Source§impl Clone for NdsBoundingBox
impl Clone for NdsBoundingBox
Source§fn clone(&self) -> NdsBoundingBox
fn clone(&self) -> NdsBoundingBox
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for NdsBoundingBox
Source§impl Debug for NdsBoundingBox
impl Debug for NdsBoundingBox
impl Eq for NdsBoundingBox
Source§impl Hash for NdsBoundingBox
impl Hash for NdsBoundingBox
Source§impl PartialEq for NdsBoundingBox
impl PartialEq for NdsBoundingBox
Source§fn eq(&self, other: &NdsBoundingBox) -> bool
fn eq(&self, other: &NdsBoundingBox) -> bool
self and other values to be equal, and is used by ==.