pub struct BoundingBox {
pub min_x: f64,
pub min_y: f64,
pub max_x: f64,
pub max_y: f64,
}Expand description
A bounding box defined by minimum and maximum coordinates.
Fields§
§min_x: f64Minimum X coordinate
min_y: f64Minimum Y coordinate
max_x: f64Maximum X coordinate
max_y: f64Maximum Y coordinate
Implementations§
Source§impl BoundingBox
impl BoundingBox
Sourcepub fn from_coordinates(c1: Coordinate, c2: Coordinate) -> Result<Self>
pub fn from_coordinates(c1: Coordinate, c2: Coordinate) -> Result<Self>
Creates a bounding box from two coordinates.
Sourcepub fn center(&self) -> Coordinate
pub fn center(&self) -> Coordinate
Returns the center coordinate of the bounding box.
Sourcepub fn corners(&self) -> [Coordinate; 4]
pub fn corners(&self) -> [Coordinate; 4]
Returns the four corner coordinates.
Sourcepub fn contains(&self, coord: &Coordinate) -> bool
pub fn contains(&self, coord: &Coordinate) -> bool
Checks if a coordinate is within the bounding box.
Sourcepub fn expand_to_include(&mut self, coord: &Coordinate)
pub fn expand_to_include(&mut self, coord: &Coordinate)
Expands the bounding box to include a coordinate.
Trait Implementations§
Source§impl Clone for BoundingBox
impl Clone for BoundingBox
Source§fn clone(&self) -> BoundingBox
fn clone(&self) -> BoundingBox
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 BoundingBox
impl Debug for BoundingBox
Source§impl PartialEq for BoundingBox
impl PartialEq for BoundingBox
impl Copy for BoundingBox
impl StructuralPartialEq for BoundingBox
Auto Trait Implementations§
impl Freeze for BoundingBox
impl RefUnwindSafe for BoundingBox
impl Send for BoundingBox
impl Sync for BoundingBox
impl Unpin for BoundingBox
impl UnsafeUnpin for BoundingBox
impl UnwindSafe for BoundingBox
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