[−][src]Struct nannou::geom::rect::Rect
Defines a Rectangle's bounds across the x and y axes.
Fields
x: Range<S>
The start and end positions of the Rectangle on the x axis.
y: Range<S>
The start and end positions of the Rectangle on the y axis.
Methods
impl<S> Rect<S> where
S: BaseNum,
[src]
S: BaseNum,
pub fn from_xy_wh(p: Point2<S>, wh: Vector2<S>) -> Self
[src]
Construct a Rect from a given Point
and Dimensions
.
pub fn from_x_y_w_h(x: S, y: S, w: S, h: S) -> Self
[src]
Construct a Rect from the given x
y
coordinates and w
h
dimensions.
pub fn from_wh(wh: Vector2<S>) -> Self
[src]
Construct a Rect at origin with the given dimensions.
pub fn from_w_h(w: S, h: S) -> Self
[src]
Construct a Rect at origin with the given width and height.
pub fn from_corners(a: Point2<S>, b: Point2<S>) -> Self
[src]
Construct a Rect from the coordinates of two points.
pub fn absolute(self) -> Self
[src]
Converts self
to an absolute Rect
so that the magnitude of each range is always
positive.
pub fn overlap(self, other: Self) -> Option<Self>
[src]
The Rect representing the area in which two Rects overlap.
pub fn max(self, other: Self) -> Self where
S: Float,
[src]
S: Float,
The Rect that encompass the two given sets of Rect.
pub fn x(&self) -> S
[src]
The position in the middle of the x bounds.
pub fn y(&self) -> S
[src]
The position in the middle of the y bounds.
pub fn xy(&self) -> Point2<S>
[src]
The xy position in the middle of the bounds.
pub fn x_y(&self) -> (S, S)
[src]
The centered x and y coordinates as a tuple.
pub fn bottom(&self) -> S
[src]
The Rect's lowest y value.
pub fn top(&self) -> S
[src]
The Rect's highest y value.
pub fn left(&self) -> S
[src]
The Rect's lowest x value.
pub fn right(&self) -> S
[src]
The Rect's highest x value.
pub fn top_left(&self) -> Point2<S>
[src]
The top left corner Point.
pub fn bottom_left(&self) -> Point2<S>
[src]
The bottom left corner Point.
pub fn top_right(&self) -> Point2<S>
[src]
The top right corner Point.
pub fn bottom_right(&self) -> Point2<S>
[src]
The bottom right corner Point.
pub fn l_r_b_t(&self) -> (S, S, S, S)
[src]
The edges of the Rect in a tuple (top, bottom, left, right).
pub fn shift_x(self, x: S) -> Self
[src]
Shift the Rect along the x axis.
pub fn shift_y(self, y: S) -> Self
[src]
Shift the Rect along the y axis.
pub fn shift(self, v: Vector2<S>) -> Self
[src]
Shift the Rect by the given vector.
pub fn contains(&self, p: Point2<S>) -> bool
[src]
Does the given point touch the Rectangle.
pub fn stretch_to_point(self, p: Point2<S>) -> Self
[src]
Stretches the closest edge(s) to the given point if the point lies outside of the Rect area.
pub fn left_of(self, other: Self) -> Self
[src]
Align self
's right edge with the left edge of the other
Rect.
pub fn right_of(self, other: Self) -> Self
[src]
Align self
's left edge with the right dge of the other
Rect.
pub fn below(self, other: Self) -> Self
[src]
Align self
's top edge with the bottom edge of the other
Rect.
pub fn above(self, other: Self) -> Self
[src]
Align self
's bottom edge with the top edge of the other
Rect.
pub fn align_x_of(self, align: Align, other: Self) -> Self
[src]
Align self
to other
along the x axis in accordance with the given Align
variant.
pub fn align_y_of(self, align: Align, other: Self) -> Self
[src]
Align self
to other
along the y axis in accordance with the given Align
variant.
pub fn align_left_of(self, other: Self) -> Self
[src]
Align self
's left edge with the left edge of the other
Rect.
pub fn align_middle_x_of(self, other: Self) -> Self
[src]
Align the middle of self
with the middle of the other
Rect along the x axis.
pub fn align_right_of(self, other: Self) -> Self
[src]
Align self
's right edge with the right edge of the other
Rect.
pub fn align_bottom_of(self, other: Self) -> Self
[src]
Align self
's bottom edge with the bottom edge of the other
Rect.
pub fn align_middle_y_of(self, other: Self) -> Self
[src]
Align the middle of self
with the middle of the other
Rect along the y axis.
pub fn align_top_of(self, other: Self) -> Self
[src]
Align self
's top edge with the top edge of the other
Rect.
pub fn top_left_of(self, other: Self) -> Self
[src]
Place self
along the top left edges of the other
Rect.
pub fn top_right_of(self, other: Self) -> Self
[src]
Place self
along the top right edges of the other
Rect.
pub fn bottom_left_of(self, other: Self) -> Self
[src]
Place self
along the bottom left edges of the other
Rect.
pub fn bottom_right_of(self, other: Self) -> Self
[src]
Place self
along the bottom right edges of the other
Rect.
pub fn mid_top_of(self, other: Self) -> Self
[src]
Place self
in the middle of the top edge of the other
Rect.
pub fn mid_bottom_of(self, other: Self) -> Self
[src]
Place self
in the middle of the bottom edge of the other
Rect.
pub fn mid_left_of(self, other: Self) -> Self
[src]
Place self
in the middle of the left edge of the other
Rect.
pub fn mid_right_of(self, other: Self) -> Self
[src]
Place self
in the middle of the right edge of the other
Rect.
pub fn middle_of(self, other: Self) -> Self
[src]
Place self
directly in the middle of the other
Rect.
pub fn closest_corner(&self, p: Point2<S>) -> Corner
[src]
Return the Corner of self
that is closest to the given Point.
pub fn corners(&self) -> Quad<Point2<S>>
[src]
The four corners of the Rect
.
ⓘImportant traits for Corners<S>pub fn corners_iter(&self) -> Corners<S>
[src]
An iterator yielding the four corners of the Rect
.
pub fn triangles(&self) -> (Tri<Point2<S>>, Tri<Point2<S>>)
[src]
Return two Tri
s that represent the Rect
.
pub fn triangles_iter(self) -> Triangles<S>
[src]
An iterator yielding the Rect
's two Tri
's.
pub fn subdivision_ranges(&self) -> SubdivisionRanges<S>
[src]
The four ranges used for the Rect
's four subdivisions.
pub fn subdivisions(&self) -> [Self; 4]
[src]
Divide the Rect
in half along the x and y axes and return the four subdivisions.
Subdivisions are yielded in the following order:
- Bottom left
- Bottom right
- Top left
- Top right
ⓘImportant traits for Subdivisions<S>pub fn subdivisions_iter(&self) -> Subdivisions<S>
[src]
The same as subdivisions
but each subdivision is yielded via the returned Iterator
.
pub fn corner_at_index(&self, index: u8) -> Option<Point2<S>>
[src]
Produce the corner at the given index.
impl<S> Rect<S> where
S: BaseNum + Neg<Output = S>,
[src]
S: BaseNum + Neg<Output = S>,
pub fn w(&self) -> S
[src]
The width of the Rect.
pub fn h(&self) -> S
[src]
The height of the Rect.
pub fn wh(&self) -> Vector2<S>
[src]
The total dimensions of the Rect.
pub fn w_h(&self) -> (S, S)
[src]
The width and height of the Rect as a tuple.
pub fn xy_wh(&self) -> (Point2<S>, Vector2<S>)
[src]
Convert the Rect to a Point
and Dimensions
.
pub fn x_y_w_h(&self) -> (S, S, S, S)
[src]
The Rect's centered coordinates and dimensions in a tuple.
pub fn len(&self) -> S
[src]
The length of the longest side of the rectangle.
pub fn l_t_w_h(&self) -> (S, S, S, S)
[src]
The left and top edges of the Rect along with the width and height.
pub fn l_b_w_h(&self) -> (S, S, S, S)
[src]
The left and bottom edges of the Rect along with the width and height.
pub fn pad_left(self, pad: S) -> Self
[src]
The Rect with some padding applied to the left edge.
pub fn pad_right(self, pad: S) -> Self
[src]
The Rect with some padding applied to the right edge.
pub fn pad_bottom(self, pad: S) -> Self
[src]
The rect with some padding applied to the bottom edge.
pub fn pad_top(self, pad: S) -> Self
[src]
The Rect with some padding applied to the top edge.
pub fn pad(self, pad: S) -> Self
[src]
The Rect with some padding amount applied to each edge.
pub fn padding(self, padding: Padding<S>) -> Self
[src]
The Rect with some padding applied.
pub fn relative_to_x(self, x: S) -> Self
[src]
Returns a Rect
with a position relative to the given position on the x axis.
pub fn relative_to_y(self, y: S) -> Self
[src]
Returns a Rect
with a position relative to the given position on the y axis.
pub fn relative_to(self, p: Point2<S>) -> Self
[src]
Returns a Rect
with a position relative to the given position.
Trait Implementations
impl<S: PartialEq> PartialEq<Rect<S>> for Rect<S>
[src]
impl<S> From<Rect<S>> for Rect<S> where
S: BaseFloat,
[src]
S: BaseFloat,
impl<S: Clone> Clone for Rect<S>
[src]
fn clone(&self) -> Rect<S>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<S: Copy> Copy for Rect<S>
[src]
impl<S: PartialOrd> PartialOrd<Rect<S>> for Rect<S>
[src]
fn partial_cmp(&self, other: &Rect<S>) -> Option<Ordering>
[src]
fn lt(&self, other: &Rect<S>) -> bool
[src]
fn le(&self, other: &Rect<S>) -> bool
[src]
fn gt(&self, other: &Rect<S>) -> bool
[src]
fn ge(&self, other: &Rect<S>) -> bool
[src]
impl<S: Debug> Debug for Rect<S>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> 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, U> TryInto<U> 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> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Style for T where
T: Any + Debug + PartialEq<T>,
[src]
T: Any + Debug + PartialEq<T>,
impl<T> Content for T
[src]
fn ref_from_ptr(ptr: *mut c_void, size: usize) -> Option<*mut T>
[src]
fn is_size_suitable(size: usize) -> bool
[src]
fn indiv_size() -> usize
[src]
impl<T> SafeBorrow<T> for T
[src]
impl<T> Erased for T
impl<S> FromSample<S> for S
[src]
fn from_sample_(s: S) -> S
[src]
impl<T, U> ToSample<U> for T where
U: FromSample<T>,
[src]
U: FromSample<T>,
fn to_sample_(self) -> U
[src]
impl<S, T> Duplex<S> for T where
T: FromSample<S> + ToSample<S>,
[src]
T: FromSample<S> + ToSample<S>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.