pub struct Outline { /* private fields */ }
Expand description
Represent closed circuit of vertices
Implementations§
Source§impl Outline
impl Outline
Sourcepub fn new(vertices: impl Iterator<Item = Vec2>) -> Self
pub fn new(vertices: impl Iterator<Item = Vec2>) -> Self
Creates new outline.
§Arguments
vertices
- iterator of vertices. They MUST follow in order, which guarantee:
- when follow from i to i+1 vertex, inner area of polygon MUST be at left side;
Sourcepub fn prev_that_next(&self, i: isize) -> (Vec2, Vec2, Vec2)
pub fn prev_that_next(&self, i: isize) -> (Vec2, Vec2, Vec2)
Tuple of (i-1
, i
, i+1
) vertices;
i
- index of vertex. May be negative;
Sourcepub fn to_neighbors(&self, i: isize) -> (Vec2, Vec2)
pub fn to_neighbors(&self, i: isize) -> (Vec2, Vec2)
Tuple of vectors to previous and to next vertex for i
-th vertex;
i
- index of vertex. May be negative;
Sourcepub fn convex(&self, i: isize) -> bool
pub fn convex(&self, i: isize) -> bool
Test if angle is convex;
i
- index of vertex. May be negative;
Sourcepub fn concave(&self, i: isize) -> bool
pub fn concave(&self, i: isize) -> bool
Test if angle is concave;
i
- index of vertex. May be negative;
Sourcepub fn inner_angle_cos_sin(&self, i: isize) -> (f32, f32)
pub fn inner_angle_cos_sin(&self, i: isize) -> (f32, f32)
sin()
and cos()
for counter-clockwise angle between vector to next vertex and vector
to previous.
§Arguments
i
- index of vertex. May be negative;
Sourcepub fn inner_angle(&self, i: isize) -> f32
pub fn inner_angle(&self, i: isize) -> f32
Sourcepub fn outer_angle(&self, i: isize) -> f32
pub fn outer_angle(&self, i: isize) -> f32
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Outline
impl RefUnwindSafe for Outline
impl Send for Outline
impl Sync for Outline
impl Unpin for Outline
impl UnwindSafe for Outline
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