[][src]Struct math2d::Recti

#[repr(C)]
pub struct Recti { pub left: i32, pub top: i32, pub right: i32, pub bottom: i32, }

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: i32

The x-coordinate of the upper-left corner of the rectangle.

top: i32

The y-coordinate of the upper-left corner of the rectangle.

right: i32

The x-coordinate of the lower-right corner of the rectangle.

bottom: i32

The 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 From<Recti> for D2D_RECT_L[src]

impl From<RECT> for Recti[src]

impl From<WICRect> for Recti[src]

impl From<Recti> for WICRect[src]

impl Clone for 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]

impl<'de> Deserialize<'de> for Recti[src]

Auto Trait Implementations

impl Send for Recti

impl Sync for Recti

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]