pub struct Rect {
pub min: [f64; 2],
pub max: [f64; 2],
}Expand description
A closed 2D box: min <= max on both axes, both finite.
Fields§
§min: [f64; 2]The lower corner, [x, y].
max: [f64; 2]The upper corner, [x, y].
Implementations§
Source§impl Rect
impl Rect
Sourcepub fn new(a: [f64; 2], b: [f64; 2]) -> Option<Self>
pub fn new(a: [f64; 2], b: [f64; 2]) -> Option<Self>
The box of two corners, in any order; None if a coordinate is not finite.
Sourcepub fn of_points(points: &[[f64; 2]]) -> Option<Self>
pub fn of_points(points: &[[f64; 2]]) -> Option<Self>
The bounding box of some points (a polygon’s, for a query by polygon);
None if there are none or one is not finite.
Sourcepub fn grown(&self, margin: f64) -> Self
pub fn grown(&self, margin: f64) -> Self
This box grown by margin on every side (a negative margin shrinks it,
and an emptied box stays a box at its centre).
Sourcepub fn intersects(&self, other: &Self) -> bool
pub fn intersects(&self, other: &Self) -> bool
The two boxes share a point (touching counts).
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 UnsafeUnpin 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