pub struct BoundingBox2D {
pub rect: Rect,
}Expand description
A 2D axis-aligned bounding box.
Represents a rectangular area defined by minimum and maximum coordinates.
This is a wrapper around geo::Rect with additional functionality.
Fields§
§rect: RectThe underlying geometric rectangle
Implementations§
Source§impl BoundingBox2D
impl BoundingBox2D
Sourcepub fn new(min_x: f64, min_y: f64, max_x: f64, max_y: f64) -> BoundingBox2D
pub fn new(min_x: f64, min_y: f64, max_x: f64, max_y: f64) -> BoundingBox2D
Create a new bounding box from minimum and maximum coordinates.
§Arguments
min_x- Minimum longitude/x coordinatemin_y- Minimum latitude/y coordinatemax_x- Maximum longitude/x coordinatemax_y- Maximum latitude/y coordinate
§Examples
use spatio_types::bbox::BoundingBox2D;
let bbox = BoundingBox2D::new(-74.0, 40.7, -73.9, 40.8);Sourcepub fn from_rect(rect: Rect) -> BoundingBox2D
pub fn from_rect(rect: Rect) -> BoundingBox2D
Create a bounding box from a geo::Rect.
Sourcepub fn contains_point(&self, point: &Point) -> bool
pub fn contains_point(&self, point: &Point) -> bool
Check if a point is contained within this bounding box.
Sourcepub fn intersects(&self, other: &BoundingBox2D) -> bool
pub fn intersects(&self, other: &BoundingBox2D) -> bool
Check if this bounding box intersects with another.
Sourcepub fn expand(&self, amount: f64) -> BoundingBox2D
pub fn expand(&self, amount: f64) -> BoundingBox2D
Expand the bounding box by a given amount in all directions.
Trait Implementations§
Source§impl Clone for BoundingBox2D
impl Clone for BoundingBox2D
Source§fn clone(&self) -> BoundingBox2D
fn clone(&self) -> BoundingBox2D
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BoundingBox2D
impl Debug for BoundingBox2D
Source§impl<'de> Deserialize<'de> for BoundingBox2D
impl<'de> Deserialize<'de> for BoundingBox2D
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<BoundingBox2D, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<BoundingBox2D, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for BoundingBox2D
impl PartialEq for BoundingBox2D
Source§impl Serialize for BoundingBox2D
impl Serialize for BoundingBox2D
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for BoundingBox2D
Auto Trait Implementations§
impl Freeze for BoundingBox2D
impl RefUnwindSafe for BoundingBox2D
impl Send for BoundingBox2D
impl Sync for BoundingBox2D
impl Unpin for BoundingBox2D
impl UnwindSafe for BoundingBox2D
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more