Struct visioncortex::Spline [−][src]
Series of connecting 2D Bezier Curves
Fields
points: Vec<PointF64>
1+3*(num_curves) points, where the first curve is represented by the first 4 points and each subsequent curve is represented by the last point in the previous curve plus 3 points Points are of PointF64 type.
Implementations
impl Spline
[src]
pub fn new(point: PointF64) -> Self
[src]
Creates an empty spline defined by a starting point
pub fn add(&mut self, point2: PointF64, point3: PointF64, point4: PointF64)
[src]
Adds a curve to the end of the spline. Takes 3 points that are the second to fourth control points of the bezier curve. Note that the first control point is taken from the last point of the previous curve.
pub fn iter(&self) -> Iter<'_, PointF64>
[src]
Returns an iterator on the vector of points on the spline
pub fn len(&self) -> usize
[src]
Returns the number of points on the spline
pub fn num_curves(&self) -> usize
[src]
Returns the number of curves on the spline
pub fn is_empty(&self) -> bool
[src]
Returns true if the spline contains no curve, false otherwise A curve is defined by 4 points, so a non-empty spline should contain at least 4 points.
pub fn offset(&mut self, offset: &PointF64)
[src]
Applies an offset to all points on the spline
pub fn from_image(
image: &BinaryImage,
clockwise: bool,
corner_threshold: f64,
outset_ratio: f64,
segment_length: f64,
max_iterations: usize,
splice_threshold: f64
) -> Self
[src]
image: &BinaryImage,
clockwise: bool,
corner_threshold: f64,
outset_ratio: f64,
segment_length: f64,
max_iterations: usize,
splice_threshold: f64
) -> Self
Returns a spline created from image. The following steps are performed:
- Convert pixels into path
- Simplify the path into polygon
- Smoothen the polygon and approximate it with a curve-fitter
Corner/Splice thresholds are specified in radians. Length threshold is specified in pixels (length unit in path coordinate system).
pub fn from_path_f64(path: &PathF64, splice_threshold: f64) -> Self
[src]
Returns a spline by curve-fitting a path.
Splice threshold is specified in radians.
pub fn to_svg_string(&self, close: bool, offset: &PointF64) -> String
[src]
Converts spline to svg path. Panic if the length of spline is not valid (not 1+3n for some integer n)
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Spline
impl Send for Spline
impl Sync for Spline
impl Unpin for Spline
impl UnwindSafe for Spline
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>,