pub struct Rectangle {
pub x: f32,
pub y: f32,
pub width: f32,
pub height: f32,
}Fields§
§x: f32§y: f32§width: f32§height: f32Implementations§
Source§impl Rectangle
impl Rectangle
pub fn new(x: f32, y: f32, width: f32, height: f32) -> Self
pub fn width(&self) -> f32
pub fn height(&self) -> f32
pub fn left(&self) -> f32
pub fn right(&self) -> f32
pub fn top(&self) -> f32
pub fn bottom(&self) -> f32
pub fn top_left(&self) -> (f32, f32)
pub fn top_right(&self) -> (f32, f32)
pub fn bottom_left(&self) -> (f32, f32)
pub fn bottom_right(&self) -> (f32, f32)
pub fn distance_to_point(&self, x: f32, y: f32) -> f32
pub fn contains_circle(&self, x: f32, y: f32, radius: f32) -> bool
pub fn contains_point(&self, x: f32, y: f32) -> bool
pub fn expand_to_include(&mut self, other: &Rectangle)
pub fn get_random_circle_coords_inside<R: Rng>( &self, radius: f32, rng: &mut R, ) -> (f32, f32)
Trait Implementations§
impl Copy for Rectangle
Auto Trait Implementations§
impl Freeze for Rectangle
impl RefUnwindSafe for Rectangle
impl Send for Rectangle
impl Sync for Rectangle
impl Unpin for Rectangle
impl UnwindSafe for Rectangle
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