Skip to main content

NdsBoundingBox

Struct NdsBoundingBox 

Source
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: i32

SW corner longitude (NDS coords).

§min_y: i32

SW corner latitude (NDS coords).

§max_x: i32

NE corner longitude (NDS coords).

§max_y: i32

NE corner latitude (NDS coords).

Implementations§

Source§

impl NdsBoundingBox

Source

pub fn new(min_x: i32, min_y: i32, max_x: i32, max_y: i32) -> Self

Construct a bounding box from explicit corner coordinates.

Source

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.

Source

pub fn contains(&self, other: &NdsBoundingBox) -> bool

Check whether this bounding box fully contains other.

Source

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.

Source

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

Source§

fn clone(&self) -> NdsBoundingBox

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for NdsBoundingBox

Source§

impl Debug for NdsBoundingBox

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for NdsBoundingBox

Source§

impl Hash for NdsBoundingBox

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for NdsBoundingBox

Source§

fn eq(&self, other: &NdsBoundingBox) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for NdsBoundingBox

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.