[−][src]Trait lyon_algorithms::walk::Pattern
Types implementing the Pattern
can be used to walk along a path
at constant speed.
At each step, the pattern receives the position, tangent and already traversed distance along the path and returns the distance until the next step.
See the RegularPattern
and RepeatedPattern
implementations.
This trait is also implemented for all functions/closures with signature
FnMut(Point, Vector, f32) -> Option<f32>
.
Required methods
fn next(
&mut self,
position: Point,
tangent: Vector,
distance: f32
) -> Option<f32>
&mut self,
position: Point,
tangent: Vector,
distance: f32
) -> Option<f32>
This method is invoked at each step along the path.
If this method returns None, path walking stops. Otherwise the returned value is the distance along the path to the next element in the pattern.
Provided methods
fn begin(&mut self, distance: f32) -> Option<f32>
Invoked at the start each sub-path.
Takes the leftover requested distance from the previous sub-path path, if any.
If this method returns None, path walking stops. Otherwise the returned value is the distance along the path to the next element in the pattern.
Implementors
impl<'l, Cb> Pattern for RepeatedPattern<'l, Cb> where
Cb: FnMut(Point, Vector, f32) -> bool,
[src]
Cb: FnMut(Point, Vector, f32) -> bool,
impl<Cb> Pattern for RegularPattern<Cb> where
Cb: FnMut(Point, Vector, f32) -> bool,
[src]
Cb: FnMut(Point, Vector, f32) -> bool,
impl<Cb> Pattern for Cb where
Cb: FnMut(Point, Vector, f32) -> Option<f32>,
[src]
Cb: FnMut(Point, Vector, f32) -> Option<f32>,