pub struct BoundingBox2D {
pub min: Array1<f64>,
pub max: Array1<f64>,
}Expand description
A 2D bounding box defined by its minimum and maximum corners
Fields§
§min: Array1<f64>Minimum coordinates of the box (lower left corner)
max: Array1<f64>Maximum coordinates of the box (upper right corner)
Implementations§
Source§impl BoundingBox2D
impl BoundingBox2D
Sourcepub fn new(
min: &ArrayView1<'_, f64>,
max: &ArrayView1<'_, f64>,
) -> SpatialResult<Self>
pub fn new( min: &ArrayView1<'_, f64>, max: &ArrayView1<'_, f64>, ) -> SpatialResult<Self>
Sourcepub fn from_points(points: &ArrayView2<'_, f64>) -> SpatialResult<Self>
pub fn from_points(points: &ArrayView2<'_, f64>) -> SpatialResult<Self>
Sourcepub fn contains(&self, point: &ArrayView1<'_, f64>) -> SpatialResult<bool>
pub fn contains(&self, point: &ArrayView1<'_, f64>) -> SpatialResult<bool>
Sourcepub fn dimensions(&self) -> Array1<f64>
pub fn dimensions(&self) -> Array1<f64>
Get the dimensions (width, height) of the bounding box
§Returns
An array containing the dimensions of the box
Sourcepub fn overlaps(&self, other: &BoundingBox2D) -> bool
pub fn overlaps(&self, other: &BoundingBox2D) -> bool
Sourcepub fn squared_distance_to_point(
&self,
point: &ArrayView1<'_, f64>,
) -> SpatialResult<f64>
pub fn squared_distance_to_point( &self, point: &ArrayView1<'_, f64>, ) -> SpatialResult<f64>
Sourcepub fn split_into_quadrants(&self) -> [BoundingBox2D; 4]
pub fn split_into_quadrants(&self) -> [BoundingBox2D; 4]
Split the bounding box into 4 equal quadrants
§Returns
An array of 4 bounding boxes representing the quadrants
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 moreAuto 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.