pub struct Rect { /* private fields */ }Expand description
A bounding rectangle with floating point coordinates.
Implementations§
Source§impl Rect
impl Rect
Sourcepub fn from_pos_size(pos: Vec2, size: Vec2) -> Self
pub fn from_pos_size(pos: Vec2, size: Vec2) -> Self
Create a Rect from a position and size.
Sourcepub fn pos(&self) -> Vec2
pub fn pos(&self) -> Vec2
The position of the rectangle’s upper-left corner. This is the minimum value enclosed by the rectangle.
Sourcepub fn contains_point(&self, point: Vec2) -> bool
pub fn contains_point(&self, point: Vec2) -> bool
Tells whether the given point is contained within the rectangle.
If the point lies on the rectangle’s boundary, it is considered inside.
Sourcepub fn intersects(&self, other: &Self) -> bool
pub fn intersects(&self, other: &Self) -> bool
Tells whether two rectangles intersect.
If the rectangles touch but do not overlap, they are considered not intersecting.
Trait Implementations§
impl Copy for Rect
impl StructuralPartialEq for Rect
Auto Trait Implementations§
impl Freeze for Rect
impl RefUnwindSafe for Rect
impl Send for Rect
impl Sync for Rect
impl Unpin for Rect
impl UnwindSafe for Rect
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