Struct graphics_shapes::polygon::Polygon
source · pub struct Polygon { /* private fields */ }Implementations
sourceimpl 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
sourcepub fn as_triangles(&self) -> Option<Vec<Triangle>>
pub fn as_triangles(&self) -> Option<Vec<Triangle>>
Cuts shape into triangles, triangles will be from the center to the edge This only works on convex polygons
Trait Implementations
sourceimpl Shape for Polygon
impl Shape for Polygon
sourcefn from_points(points: Vec<Coord>) -> Selfwhere
Self: Sized,
fn from_points(points: Vec<Coord>) -> Selfwhere
Self: Sized,
create this shape from a list of points
sourcefn translate_by<P: Into<Coord>>(&self, delta: P) -> Selfwhere
Self: Sized,
fn translate_by<P: Into<Coord>>(&self, delta: P) -> Selfwhere
Self: Sized,
change every point by +
deltasourcefn move_to<P: Into<Coord>>(&self, point: P) -> Selfwhere
Self: Sized,
fn move_to<P: Into<Coord>>(&self, point: P) -> Selfwhere
Self: Sized,
moves the shapes first point to
point
(and changes every other point to match their original distance and angle) Read morefn rotate(&self, degrees: isize) -> Selfwhere
Self: Sized,
fn rotate_around<P: Into<Coord>>(&self, degrees: isize, point: P) -> Selfwhere
Self: Sized,
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more