Struct nannou::geom::rect::Rect[][src]

pub struct Rect<S = Default> {
    pub x: Range<S>,
    pub y: Range<S>,
}

Defines a Rectangle's bounds across the x and y axes.

Fields

The start and end positions of the Rectangle on the x axis.

The start and end positions of the Rectangle on the y axis.

Methods

impl<S> Rect<S> where
    S: BaseNum
[src]

Construct a Rect from a given Point and Dimensions.

Construct a Rect from the given x y coordinates and w h dimensions.

Construct a Rect at origin with the given dimensions.

Construct a Rect at origin with the given width and height.

Construct a Rect from the coordinates of two points.

Converts self to an absolute Rect so that the magnitude of each range is always positive.

The Rect representing the area in which two Rects overlap.

The Rect that encompass the two given sets of Rect.

The position in the middle of the x bounds.

The position in the middle of the y bounds.

The xy position in the middle of the bounds.

The centered x and y coordinates as a tuple.

The Rect's lowest y value.

The Rect's highest y value.

The Rect's lowest x value.

The Rect's highest x value.

The top left corner Point.

The bottom left corner Point.

The top right corner Point.

The bottom right corner Point.

The edges of the Rect in a tuple (top, bottom, left, right).

Shift the Rect along the x axis.

Shift the Rect along the y axis.

Shift the Rect by the given vector.

Does the given point touch the Rectangle.

Stretches the closest edge(s) to the given point if the point lies outside of the Rect area.

Align self's right edge with the left edge of the other Rect.

Align self's left edge with the right dge of the other Rect.

Align self's top edge with the bottom edge of the other Rect.

Align self's bottom edge with the top edge of the other Rect.

Align self to other along the x axis in accordance with the given Align variant.

Align self to other along the y axis in accordance with the given Align variant.

Align self's left edge with the left edge of the other Rect.

Align the middle of self with the middle of the other Rect along the x axis.

Align self's right edge with the right edge of the other Rect.

Align self's bottom edge with the bottom edge of the other Rect.

Align the middle of self with the middle of the other Rect along the y axis.

Align self's top edge with the top edge of the other Rect.

Place self along the top left edges of the other Rect.

Place self along the top right edges of the other Rect.

Place self along the bottom left edges of the other Rect.

Place self along the bottom right edges of the other Rect.

Place self in the middle of the top edge of the other Rect.

Place self in the middle of the bottom edge of the other Rect.

Place self in the middle of the left edge of the other Rect.

Place self in the middle of the right edge of the other Rect.

Place self directly in the middle of the other Rect.

Return the Corner of self that is closest to the given Point.

Thee four corners of the Rect.

Important traits for Corners<S>

An iterator yielding the four corners of the Rect.

Return two Tris that represent the Rect.

An iterator yielding the Rect's two Tri's.

The four ranges used for the Rect's four subdivisions.

Divide the Rect in half along the x and y axes and return the four subdivisions.

Subdivisions are yielded in the following order:

  1. Bottom left
  2. Bottom right
  3. Top left
  4. Top right

Important traits for Subdivisions<S>

The same as subdivisions but each subdivision is yielded via the returned Iterator.

Produce the corner at the given index.

impl<S> Rect<S> where
    S: BaseNum + Neg<Output = S>, 
[src]

The width of the Rect.

The height of the Rect.

The total dimensions of the Rect.

The width and height of the Rect as a tuple.

Convert the Rect to a Point and Dimensions.

The Rect's centered coordinates and dimensions in a tuple.

The length of the longest side of the rectangle.

The left and top edges of the Rect along with the width and height.

The left and bottom edges of the Rect along with the width and height.

The Rect with some padding applied to the left edge.

The Rect with some padding applied to the right edge.

The rect with some padding applied to the bottom edge.

The Rect with some padding applied to the top edge.

The Rect with some padding amount applied to each edge.

The Rect with some padding applied.

Returns a Rect with a position relative to the given position on the x axis.

Returns a Rect with a position relative to the given position on the y axis.

Returns a Rect with a position relative to the given position.

Trait Implementations

impl<S> From<Rect<S>> for Rect<S> where
    S: BaseFloat
[src]

Performs the conversion.

impl<S: Copy> Copy for Rect<S>
[src]

impl<S: Clone> Clone for Rect<S>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<S: Debug> Debug for Rect<S>
[src]

Formats the value using the given formatter. Read more

impl<S: PartialEq> PartialEq for Rect<S>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<S: PartialOrd> PartialOrd for Rect<S>
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

impl<S> Send for Rect<S> where
    S: Send

impl<S> Sync for Rect<S> where
    S: Sync