pub struct BoundingBox { /* private fields */ }
Expand description
Defines a rectangular bounding box.
The Y axis convention is downwards.
Implementations§
Source§impl BoundingBox
impl BoundingBox
Sourcepub fn new(center: Point, width: f64, height: f64) -> Self
pub fn new(center: Point, width: f64, height: f64) -> Self
Constructs a new bounding box.
§Arguments
center
- The position of the center of the bounding boxwidth
- The bounding box’s widthheight
- The bounding box’s height
Sourcepub fn new_centered(width: f64, height: f64) -> Self
pub fn new_centered(width: f64, height: f64) -> Self
Constructs a new bounding box centeterd at origin with the provided width and height.
Sourcepub fn new_centered_square(width: f64) -> Self
pub fn new_centered_square(width: f64) -> Self
Constructs a new square bounding box centeterd at origin with the provided width.
Sourcepub fn top_right(&self) -> &Point
pub fn top_right(&self) -> &Point
Gets the position of the top right corner of the bounding box.
Sourcepub fn bottom_left(&self) -> &Point
pub fn bottom_left(&self) -> &Point
Gets the position of the bottom left corner of the bounding box.
Sourcepub fn is_inside(&self, point: &Point) -> bool
pub fn is_inside(&self, point: &Point) -> bool
Returns whether a given point is inside (or on the edges) of the bounding box.
pub fn is_exclusively_inside(&self, point: &Point) -> bool
Trait Implementations§
Source§impl Clone for BoundingBox
impl Clone for BoundingBox
Source§fn clone(&self) -> BoundingBox
fn clone(&self) -> BoundingBox
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 BoundingBox
impl Debug 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 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