Struct visioncortex::Path
source · [−]pub struct Path<T> {
pub path: Vec<T>,
}
Expand description
Path of generic points in 2D space
Fields
path: Vec<T>
T can be PointI32/PointF64, etc. (see src/point.rs).
Implementations
Creates a 2D Path with ‘points’ as its points
Removes the last point from the path and returns it, or None if it is empty.
Generates a string representation of the path in SVG format.
Takes a bool to indicate whether the end should be wrapped back to start.
An offset is specified to apply an offset to the display points (useful when displaying on canvas elements).
If close
is true, assume the last point of the path repeats the first point
Path is a closed path (shape), but the reduce algorithm only reduces open paths. We divide the path into four sections, spliced at the extreme points (max-x max-y min-x min-y), and reduce each section individually. Thus the most simplified path consists of at least 4 points. This function assumes the last point of the path repeats the first point.
Returns a copy of self after Path Smoothing, preserving corners.
corner_threshold
is specified in radians.
outset_ratio
is a real number >= 1.0.
segment_length
is specified in pixels (length unit in path coordinate system).
Returns a copy of self after Path Simplification:
First remove staircases then simplify by limiting penalties.
pub fn image_to_path(
image: &BinaryImage,
clockwise: bool,
mode: PathSimplifyMode
) -> PathI32
pub fn image_to_path(
image: &BinaryImage,
clockwise: bool,
mode: PathSimplifyMode
) -> PathI32
Converts outline of pixel cluster to path with Path Walker. Takes a bool representing the clockwiseness of traversal (useful in svg representation to represent holes). Takes an enum PathSimplifyMode which indicates the required operation:
- Polygon - Walk path and simplify it
- Otherwise - Walk path only
Returns a copy of self converted to PathF64
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Path<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Path<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more