Trait lyon_algorithms::walk::Pattern
source · pub trait Pattern {
// Required method
fn next(
&mut self,
position: Point,
tangent: Vector,
distance: f32
) -> Option<f32>;
// Provided method
fn begin(&mut self, distance: f32) -> Option<f32> { ... }
}
Expand description
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§
Provided Methods§
sourcefn begin(&mut self, distance: f32) -> Option<f32>
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.