[−][src]Struct math2d::Recti
Represents a rectangle defined by the coordinates of the upper-left corner (left, top) and the coordinates of the lower-right corner (right, bottom).
Fields
left: i32The x-coordinate of the upper-left corner of the rectangle.
top: i32The y-coordinate of the upper-left corner of the rectangle.
right: i32The x-coordinate of the lower-right corner of the rectangle.
bottom: i32The y-coordinate of the lower-right corner of the rectangle.
Methods
impl Recti[src]
pub const EMPTY: Recti[src]
An inversely empty rectangle that contains no points
pub fn new(left: i32, top: i32, right: i32, bottom: i32) -> Recti[src]
Constructs the rectangle from components.
pub fn point(point: impl Into<Point2i>) -> Self[src]
pub fn to_f32(&self) -> Rectf[src]
Converts the rectangle to floating point values.
pub fn to_u32(&self) -> Rectu[src]
Converts the components of the rectangle to unsigned integers. Beware this conversion if the components could be negative, you will experience unsigned casting underflow.
pub fn contains_point(&self, point: impl Into<Point2i>) -> bool[src]
Determines if the specified point is located inside the rectangle.
pub fn is_on_edge(&self, point: impl Into<Point2i>) -> bool[src]
pub fn normalized(self) -> Self[src]
Normalizes the rectangle to enforce the invariants
left < right and top < bottom.
pub fn combined_with(&self, other: impl Into<Recti>) -> Self[src]
Constructs a rectangle that contains both rectangles. Normalizes both arguments before performing the operation.
pub fn width(&self) -> i32[src]
pub fn height(&self) -> i32[src]
pub fn area(&self) -> i64[src]
pub fn rows(&self) -> impl Iterator<Item = i32>[src]
pub fn columns(&self) -> impl Iterator<Item = i32>[src]
pub fn points(self) -> impl Iterator<Item = Point2i>[src]
Trait Implementations
impl Copy for Recti[src]
impl PartialEq<Recti> for Recti[src]
impl Default for Recti[src]
impl From<Point2i> for Recti[src]
impl Clone for Recti[src]
fn clone(&self) -> Recti[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Eq for Recti[src]
impl Debug for Recti[src]
impl Serialize for Recti[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer, [src]
__S: Serializer,
impl<'de> Deserialize<'de> for Recti[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]
__D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
impl<T> From for T[src]
impl<T, U> TryFrom for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>, [src]
T: Deserialize<'de>,