Module lyon_path::walk
[−]
[src]
Path walking
Path walking enables moving along a path.
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_path::walk::RegularPattern; use lyon_path::default::PathSlice; use lyon_path::iterator::*; use lyon_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. path.path_iter() .flattened(tolerance) .walk(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 |