pub struct Rect { /* private fields */ }Expand description
A 2D axis-aligned bounding rectangle.
Wraps the manifold3d Rect type, providing spatial queries (containment,
overlap), combining operations (union, expand), and transforms.
Obtain a Rect from CrossSection::bounds,
or construct one directly from min/max coordinates.
Implementations§
Source§impl Rect
impl Rect
Sourcepub fn dimensions(&self) -> [f64; 2]
pub fn dimensions(&self) -> [f64; 2]
Dimensions [width, height].
Sourcepub fn is_finite(&self) -> bool
pub fn is_finite(&self) -> bool
Whether the rectangle has finite (non-infinite, non-NaN) bounds.
Sourcepub fn contains_point(&self, point: [f64; 2]) -> bool
pub fn contains_point(&self, point: [f64; 2]) -> bool
Whether the rectangle fully contains the given point.
Sourcepub fn contains_rect(&self, other: &Rect) -> bool
pub fn contains_rect(&self, other: &Rect) -> bool
Whether the rectangle fully contains another rectangle.
Sourcepub fn overlaps_rect(&self, other: &Rect) -> bool
pub fn overlaps_rect(&self, other: &Rect) -> bool
Whether this rectangle overlaps with another rectangle.
Sourcepub fn include_point(&mut self, point: [f64; 2])
pub fn include_point(&mut self, point: [f64; 2])
Expand this rectangle to include the given point.
Sourcepub fn union(&self, other: &Rect) -> Rect
pub fn union(&self, other: &Rect) -> Rect
Return the union (smallest rectangle containing both) of two rectangles.
Trait Implementations§
impl Send for Rect
impl Sync for Rect
Auto Trait Implementations§
impl Freeze for Rect
impl RefUnwindSafe 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.