Struct buffer_graphics_lib::prelude::Polygon
source · pub struct Polygon { /* private fields */ }
Implementations§
source§impl Polygon
impl Polygon
sourcepub fn as_inner_circle(&self) -> Circle
pub fn as_inner_circle(&self) -> Circle
Creates a circle using the point closest to the center
sourcepub fn as_outer_circle(&self) -> Circle
pub fn as_outer_circle(&self) -> Circle
Creates a circle using the point farthest to the center
sourcepub fn as_avg_circle(&self) -> Circle
pub fn as_avg_circle(&self) -> Circle
Creates a circle using the average point distance from the center
sourcepub fn as_circle(&self) -> Option<Circle>
pub fn as_circle(&self) -> Option<Circle>
If the polygon is regular then it returns a circle from center to the first point
pub fn as_rect(&self) -> Rect
Trait Implementations§
source§impl FromDrawable<Polygon> for ShapeBox
impl FromDrawable<Polygon> for ShapeBox
source§impl PartialEq<Polygon> for Polygon
impl PartialEq<Polygon> for Polygon
source§impl Shape for Polygon
impl Shape for Polygon
source§fn from_points(points: &[Coord]) -> Polygonwhere
Polygon: Sized,
fn from_points(points: &[Coord]) -> Polygonwhere Polygon: 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 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 moresource§fn move_center_to<P>(&self, point: P) -> Selfwhere
P: Into<Coord>,
Self: Sized,
fn move_center_to<P>(&self, point: P) -> Selfwhere P: Into<Coord>, Self: Sized,
moves the shapes centerto
point
(and changes every other point to match their original distance and angle) Read moresource§fn rotate_around<P>(&self, degrees: isize, point: P) -> Selfwhere
P: Into<Coord>,
Self: Sized,
fn rotate_around<P>(&self, degrees: isize, point: P) -> Selfwhere P: Into<Coord>, Self: Sized,
rotate shape around a point
impl StructuralPartialEq for Polygon
Auto Trait Implementations§
impl RefUnwindSafe for Polygon
impl Send for Polygon
impl Sync for Polygon
impl Unpin for Polygon
impl UnwindSafe for Polygon
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