pub trait Shape {
Show 15 methods // Required methods fn from_points(points: &[Coord]) -> Self where Self: Sized; fn contains<P>(&self, point: P) -> bool where P: Into<Coord>; fn points(&self) -> Vec<Coord, Global>; fn center(&self) -> Coord; // Provided methods fn translate_by<P>(&self, delta: P) -> Self where P: Into<Coord>, Self: Sized { ... } fn move_to<P>(&self, point: P) -> Self where P: Into<Coord>, Self: Sized { ... } fn move_center_to<P>(&self, point: P) -> Self where P: Into<Coord>, Self: Sized { ... } fn rotate(&self, degrees: isize) -> Self where Self: Sized { ... } fn rotate_around<P>(&self, degrees: isize, point: P) -> Self where P: Into<Coord>, 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>(&self, factor: f32, point: P) -> Self where P: Into<Coord>, Self: Sized { ... }
}

Required Methods§

source

fn from_points(points: &[Coord]) -> Selfwhere Self: Sized,

create this shape from a list of points

source

fn contains<P>(&self, point: P) -> boolwhere P: Into<Coord>,

returns true if the shape contains point

source

fn points(&self) -> Vec<Coord, Global>

points(corners) the shape is made of

source

fn center(&self) -> Coord

center of shape

Provided Methods§

source

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,

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

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

source

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)

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

source

fn rotate(&self, degrees: isize) -> Selfwhere Self: Sized,

rotate shape around it’s center

source

fn rotate_around<P>(&self, degrees: isize, point: P) -> Selfwhere P: Into<Coord>, Self: Sized,

rotate shape around a point

source

fn left(&self) -> isize

x of the left most point

source

fn right(&self) -> isize

x of the right most point

source

fn top(&self) -> isize

y of the top most point

source

fn bottom(&self) -> isize

y of the bottom most point

source

fn scale(&self, factor: f32) -> Selfwhere Self: Sized,

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

source

fn scale_around<P>(&self, factor: f32, point: P) -> Selfwhere P: Into<Coord>, Self: Sized,

scale the shape by factor around point

Implementors§