Struct pixels_graphics_lib::prelude::Rect
source · pub struct Rect { /* private fields */ }
Expand description
Rectangle
Must have flat edges, to rotate first convert to Polygon using Rect::as_polygon()
Implementations§
source§impl Rect
impl Rect
sourcepub fn as_smallest_circle(&self) -> Circle
pub fn as_smallest_circle(&self) -> Circle
Create a circle around the center to the closest edge
sourcepub fn as_biggest_circle(&self) -> Circle
pub fn as_biggest_circle(&self) -> Circle
Create a circle around the center to the farthest edge
sourcepub fn as_triangles(&self) -> (Triangle, Triangle)
pub fn as_triangles(&self) -> (Triangle, Triangle)
Create two triangles
sourcepub fn as_polygon(&self) -> Polygon
pub fn as_polygon(&self) -> Polygon
Same shape but represented as four points/lines instead of two points
pub fn as_ellipse(&self) -> Ellipse
Trait Implementations§
source§impl PartialEq<Rect> for Rect
impl PartialEq<Rect> for Rect
source§impl Shape for Rect
impl Shape for Rect
source§fn from_points(points: &[Coord]) -> Rectwhere
Rect: Sized,
fn from_points(points: &[Coord]) -> Rectwhere
Rect: Sized,
create this shape from a list of points
source§fn contains<P>(&self, point: P) -> boolwhere
P: Into<Coord>,
fn contains<P>(&self, point: P) -> boolwhere
P: Into<Coord>,
returns true if the shape contains point
source§fn rotate_around<P>(&self, degrees: isize, point: P) -> Rectwhere
P: Into<Coord>,
Rect: Sized,
fn rotate_around<P>(&self, degrees: isize, point: P) -> Rectwhere
P: Into<Coord>,
Rect: Sized,
rotate shape around a point
source§fn translate_by<P>(&self, delta: P) -> Selfwhere
P: Into<Coord>,
Self: Sized,
fn translate_by<P>(&self, delta: P) -> Selfwhere
P: Into<Coord>,
Self: Sized,
change every point by +
delta
source§fn move_to<P>(&self, point: P) -> Selfwhere
P: Into<Coord>,
Self: Sized,
fn move_to<P>(&self, point: P) -> Selfwhere
P: Into<Coord>,
Self: Sized,
moves the shapes first point to
point
(and changes every other point to match their original distance and angle) Read moreimpl Eq for Rect
impl StructuralEq for Rect
impl StructuralPartialEq for Rect
Auto Trait Implementations§
impl RefUnwindSafe for Rect
impl Send for Rect
impl Sync for Rect
impl Unpin for Rect
impl UnwindSafe for Rect
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.