pub trait Shape {
Show 14 methods fn from_points(points: Vec<Coord>) -> Self
   where
        Self: Sized
; fn contains<P: Into<Coord>>(&self, point: P) -> bool; fn points(&self) -> Vec<Coord>; fn center(&self) -> Coord; fn translate_by<P: Into<Coord>>(&self, delta: P) -> Self
   where
        Self: Sized
, { ... } fn move_to<P: Into<Coord>>(&self, point: P) -> Self
   where
        Self: Sized
, { ... } fn rotate(&self, degrees: isize) -> Self
   where
        Self: Sized
, { ... } fn rotate_around<P: Into<Coord>>(&self, degrees: isize, point: P) -> Self
   where
        Self: Sized
, { ... } fn left(&self) -> isize { ... } fn right(&self) -> isize { ... } fn top(&self) -> isize { ... } fn bottom(&self) -> isize { ... } fn scale(&self, factor: f32) -> Self
   where
        Self: Sized
, { ... } fn scale_around<P: Into<Coord>>(&self, factor: f32, point: P) -> Self
   where
        Self: Sized
, { ... }
}

Required Methods

create this shape from a list of points

returns true if the shape contains point

points(corners) the shape is made of

center of shape

Provided Methods

change every point by +delta

moves the shapes first point to point (and changes every other point to match their original distance and angle)

As this moves self.point[0] the result might be unexpected if the shape was created right to left and/or bottom to top

x of the left most point

x of the right most point

y of the top most point

y of the bottom most point

scale the shape by factor (around the center, so the change will be uniform)

scale the shape by factor around point

Implementors