pub struct BoundingBox2D { /* private fields */ }
Expand description
BoundingBox2D, an axis aligned bounding box within 2D space
Implementations§
Source§impl BoundingBox2D
impl BoundingBox2D
Sourcepub fn new<P1, P2>(min: &P1, max: &P2) -> Result<BoundingBox2D>
pub fn new<P1, P2>(min: &P1, max: &P2) -> Result<BoundingBox2D>
Creates a new BoundingBox2D with the given min and max positions
Sourcepub fn from_iterator<'a, It2D, P>(source: It2D) -> Result<BoundingBox2D>
pub fn from_iterator<'a, It2D, P>(source: It2D) -> Result<BoundingBox2D>
Creates a new BoundingBox2D which contains all the given positions
Sourcepub fn from_into_iterator<It2D, P>(source: It2D) -> Result<BoundingBox2D>
pub fn from_into_iterator<It2D, P>(source: It2D) -> Result<BoundingBox2D>
Creates a new BoundingBox2D which contains all the given positions
Sourcepub fn is_inside(&self, other: &BoundingBox2D) -> bool
pub fn is_inside(&self, other: &BoundingBox2D) -> bool
Tests whether this bounding box is within the other
Sourcepub fn contains<P>(&self, other: &P) -> bool
pub fn contains<P>(&self, other: &P) -> bool
Tests whether this bounding box contains a position
Sourcepub fn has_inside(&self, other: &BoundingBox2D) -> bool
pub fn has_inside(&self, other: &BoundingBox2D) -> bool
Tests whether this bounding box contains the other
Sourcepub fn collides_with(&self, other: &BoundingBox2D) -> bool
pub fn collides_with(&self, other: &BoundingBox2D) -> bool
Tests whether this bounding box and the other overlap in any way
Sourcepub fn crossing_x_value(&self, x: f64) -> bool
pub fn crossing_x_value(&self, x: f64) -> bool
Tests whether this bounding box crosses a certain x value
Sourcepub fn crossing_y_value(&self, y: f64) -> bool
pub fn crossing_y_value(&self, y: f64) -> bool
Tests whether this bounding box crosses a certain y value
Sourcepub fn distance<P>(&self, other: &P) -> NonNegativewhere
P: Is2D,
pub fn distance<P>(&self, other: &P) -> NonNegativewhere
P: Is2D,
Returns the distance to another Is2D
Sourcepub fn sqr_distance<P>(&self, other: &P) -> NonNegativewhere
P: Is2D,
pub fn sqr_distance<P>(&self, other: &P) -> NonNegativewhere
P: Is2D,
Returns the square distance to another Is2D
Trait Implementations§
Source§impl Clone for BoundingBox2D
impl Clone for BoundingBox2D
Source§fn clone(&self) -> BoundingBox2D
fn clone(&self) -> BoundingBox2D
Returns a copy 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 Default for BoundingBox2D
impl Default for BoundingBox2D
Source§impl From<BoundingBox2D> for Box2D
impl From<BoundingBox2D> for Box2D
Source§fn from(x: BoundingBox2D) -> Self
fn from(x: BoundingBox2D) -> Self
Converts to this type from the input type.
Source§impl From<BoundingBox2D> for FilterBox2D
impl From<BoundingBox2D> for FilterBox2D
Source§fn from(x: BoundingBox2D) -> Self
fn from(x: BoundingBox2D) -> Self
Converts to this type from the input type.
Source§impl HasBoundingBox2D for BoundingBox2D
impl HasBoundingBox2D for BoundingBox2D
Source§fn bounding_box(&self) -> BoundingBox2D
fn bounding_box(&self) -> BoundingBox2D
Should return the bounding box if it can be calculated
Source§impl HasBoundingBox2DMaybe for BoundingBox2D
impl HasBoundingBox2DMaybe for BoundingBox2D
Source§fn bounding_box_maybe(&self) -> Result<BoundingBox2D>
fn bounding_box_maybe(&self) -> Result<BoundingBox2D>
Should return the bounding box if it can be calculated
Source§impl HasDistanceTo<BoundingBox2D> for BoundingBox2D
impl HasDistanceTo<BoundingBox2D> for BoundingBox2D
Source§fn sqr_distance(&self, other: &BoundingBox2D) -> NonNegative
fn sqr_distance(&self, other: &BoundingBox2D) -> NonNegative
Should return the sqr distance to other
Source§fn distance(&self, other: &T) -> NonNegative
fn distance(&self, other: &T) -> NonNegative
The distance to other
Source§impl Hash for BoundingBox2D
impl Hash for BoundingBox2D
Source§impl Is2D for BoundingBox2D
impl Is2D for BoundingBox2D
Source§fn abs(&self) -> NonNegative
fn abs(&self) -> NonNegative
The absolute / length of this position
Source§impl IsMergeable for BoundingBox2D
impl IsMergeable for BoundingBox2D
Source§impl IsMovable2D for BoundingBox2D
impl IsMovable2D for BoundingBox2D
Source§impl IsND for BoundingBox2D
impl IsND for BoundingBox2D
Source§fn n_dimensions() -> usize
fn n_dimensions() -> usize
Should return the number of dimensions. E.g. 2 for points in 2D space, 3 for points in 3D space etc.
Source§impl IsScalable for BoundingBox2D
impl IsScalable for BoundingBox2D
Source§impl Ord for BoundingBox2D
impl Ord for BoundingBox2D
Source§fn cmp(&self, other: &BoundingBox2D) -> Ordering
fn cmp(&self, other: &BoundingBox2D) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for BoundingBox2D
impl PartialEq for BoundingBox2D
Source§impl PartialOrd for BoundingBox2D
impl PartialOrd for BoundingBox2D
impl Eq for BoundingBox2D
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