Struct visioncortex::Path [−][src]
Path of generic points in 2D space
Fields
path: Vec<T>
T can be PointI32/PointF64, etc. (see src/point.rs).
Implementations
impl<T> Path<T>
[src]
pub fn new() -> Self
[src]
Creates a new 2D Path with no points
pub fn add(&mut self, point: T)
[src]
Adds a point to the end of the path
pub fn iter(&self) -> Iter<'_, T>
[src]
Returns an iterator on the vector of points in the path
pub fn len(&self) -> usize
[src]
Returns the number of points in the path
pub fn is_empty(&self) -> bool
[src]
Returns true if the path is empty, false otherwise
impl<T> Path<T> where
T: AddAssign + Copy,
[src]
T: AddAssign + Copy,
impl<T> Path<T> where
T: ToSvgString + Copy + Add<Output = T>,
[src]
T: ToSvgString + Copy + Add<Output = T>,
pub fn to_svg_string(&self, close: bool, offset: &T) -> String
[src]
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
impl<T> Path<Point2<T>> where
T: Add<Output = T> + Sub<Output = T> + Mul<Output = T> + PartialEq + PartialOrd + Copy + Into<f64>,
[src]
T: Add<Output = T> + Sub<Output = T> + Mul<Output = T> + PartialEq + PartialOrd + Copy + Into<f64>,
pub fn reduce(&self, tolerance: f64) -> Option<Self>
[src]
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.
impl Path<Point2<i32>>
[src]
pub fn smooth(
&self,
corner_threshold: f64,
outset_ratio: f64,
segment_length: f64,
max_iterations: usize
) -> PathF64
[src]
&self,
corner_threshold: f64,
outset_ratio: f64,
segment_length: f64,
max_iterations: usize
) -> PathF64
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).
impl Path<Point2<f64>>
[src]
pub fn smooth(
&self,
corner_threshold: f64,
outset_ratio: f64,
segment_length: f64,
max_iterations: usize
) -> PathF64
[src]
&self,
corner_threshold: f64,
outset_ratio: f64,
segment_length: f64,
max_iterations: usize
) -> PathF64
impl Path<Point2<i32>>
[src]
pub fn simplify(&self, clockwise: bool) -> Self
[src]
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
[src]
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
pub fn to_path_f64(&self) -> PathF64
[src]
Returns a copy of self converted to PathF64
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Path<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Path<T> where
T: Send,
T: Send,
impl<T> Sync for Path<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Path<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Path<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,