Struct buffer_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_inner_circle(&self) -> Circle
 
pub fn as_inner_circle(&self) -> Circle
Create a circle around the center to the closest edge
sourcepub fn as_outer_circle(&self) -> Circle
 
pub fn as_outer_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_outer_ellipse(&self) -> Ellipse
pub fn as_lines(&self) -> [Line; 4]
Trait Implementations§
source§impl ContainsShape for Rect
 
impl ContainsShape for Rect
source§fn contains_circle(&self, circle: &Circle) -> bool
 
fn contains_circle(&self, circle: &Circle) -> bool
Returns true if 
self contains circlesource§fn contains_rect(&self, rect: &Rect) -> bool
 
fn contains_rect(&self, rect: &Rect) -> bool
Returns true if 
self contains rectsource§fn contains_line(&self, line: &Line) -> bool
 
fn contains_line(&self, line: &Line) -> bool
Returns true if 
self contains linesource§fn contains_triangle(&self, triangle: &Triangle) -> bool
 
fn contains_triangle(&self, triangle: &Triangle) -> bool
Returns true if 
self contains trianglesource§fn contains_ellipse(&self, ellipse: &Ellipse) -> bool
 
fn contains_ellipse(&self, ellipse: &Ellipse) -> bool
Returns true if 
self contains ellipsesource§impl<'de> Deserialize<'de> for Rect
 
impl<'de> Deserialize<'de> for Rect
source§fn deserialize<__D>(
    __deserializer: __D
) -> Result<Rect, <__D as Deserializer<'de>>::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>(
    __deserializer: __D
) -> Result<Rect, <__D as Deserializer<'de>>::Error>where
    __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl IntersectsContains for Rect
 
impl IntersectsContains for Rect
source§impl IntersectsShape for Rect
 
impl IntersectsShape for Rect
source§fn intersects_rect(&self, rect: &Rect) -> bool
 
fn intersects_rect(&self, rect: &Rect) -> bool
Returns true if 
rect intersects selfsource§fn intersects_circle(&self, circle: &Circle) -> bool
 
fn intersects_circle(&self, circle: &Circle) -> bool
Returns true if 
circle intersects selfsource§fn intersects_line(&self, line: &Line) -> bool
 
fn intersects_line(&self, line: &Line) -> bool
Returns true if 
line intersects selfsource§fn intersects_triangle(&self, triangle: &Triangle) -> bool
 
fn intersects_triangle(&self, triangle: &Triangle) -> bool
Returns true if 
triangle intersects selfsource§fn intersects_ellipse(&self, ellipse: &Ellipse) -> bool
 
fn intersects_ellipse(&self, ellipse: &Ellipse) -> bool
Returns true if 
ellipse intersects selfsource§fn intersects_polygon(&self, polygon: &Polygon) -> bool
 
fn intersects_polygon(&self, polygon: &Polygon) -> bool
Returns true if 
polygon intersects selfsource§impl PartialEq for Rect
 
impl PartialEq for Rect
source§impl Serialize for Rect
 
impl Serialize for Rect
source§fn serialize<__S>(
    &self,
    __serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
    __S: Serializer,
 
fn serialize<__S>(
    &self,
    __serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
    __S: Serializer,
Serialize this value into the given Serde serializer. Read more
source§impl Shape for Rect
 
impl Shape for Rect
source§fn from_points(points: &[Coord]) -> Rect
 
fn from_points(points: &[Coord]) -> Rect
create this shape from a list of points (corners of a shape or tips of a line)
fn rebuild(&self, points: &[Coord]) -> Rect
source§fn outline_pixels(&self) -> Vec<Coord>
 
fn outline_pixels(&self) -> Vec<Coord>
The coords for drawing the shape outline, the points may be in any order
This should be cached rather than called per frame
source§fn filled_pixels(&self) -> Vec<Coord>
 
fn filled_pixels(&self) -> Vec<Coord>
The coords for drawing the filled shape, the points may be in any order
This should be cached rather than called per frame
fn to_shape_box(&self) -> ShapeBox
source§fn translate_by(&self, delta: Coord) -> Selfwhere
    Self: Sized,
 
fn translate_by(&self, delta: Coord) -> Selfwhere
    Self: Sized,
change every point by +
deltasource§fn move_to(&self, point: Coord) -> Selfwhere
    Self: Sized,
 
fn move_to(&self, point: Coord) -> Selfwhere
    Self: Sized,
moves the shapes first point to 
point
(and changes every other point to match their original distance and angle) Read moresource§fn move_center_to(&self, point: Coord) -> Selfwhere
    Self: Sized,
 
fn move_center_to(&self, point: Coord) -> Selfwhere
    Self: Sized,
Moves the shapes center to 
point
(and changes every other point to match their original distance and angle) Read morefn top_left(&self) -> Coord
fn top_right(&self) -> Coord
fn bottom_left(&self) -> Coord
fn bottom_right(&self) -> Coord
impl 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<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more