[−][src]Module lyon_algorithms::walk
Move at a defined speed along a path.
Path walking
Overview
In principle, walking a path is similar to iterating over it, but instead of going from receiving path segments (of varying sizes), the path walker makes it possible to advance by a certain distance along the path.
Example
use lyon_algorithms::walk::{RegularPattern, walk_along_path}; use lyon_algorithms::path::PathSlice; use lyon_algorithms::path::iterator::*; use lyon_algorithms::path::math::Point; fn dots_along_path(path: PathSlice, dots: &mut Vec<Point>) { let mut pattern = RegularPattern { callback: &mut |position, _tangent, _distance| { dots.push(position); true // Return true to continue walking the path. }, // Invoke the callback above at a regular interval of 3 units. interval: 3.0, }; let tolerance = 0.01; // The path flattening tolerance. let start_offset = 0.0; // Start walking at the beginning of the path. walk_along_path( path.iter().flattened(tolerance), start_offset, &mut pattern ); }
Structs
PathWalker | A helper struct to walk along a flattened path using a builder API. |
RegularPattern | A simple pattern that invokes a callback at regular intervals. |
RepeatedPattern | A pattern that invokes a callback at a repeated sequence of constant intervals. |
Traits
Pattern | Types implementing the |
Functions
walk_along_path | Walks along the path staring at offset |