Struct kurbo::BezPath

source ·
pub struct BezPath(_);
Expand description

A path that can Bézier segments up to cubic, possibly with multiple subpaths.

Implementations§

Create a new path.

Create a path from a vector of path elements.

Push a generic path element onto the path.

Push a moveto element onto the path.

Push a lineto element onto the path.

Push a quadto element onto the path.

Push a curveto element onto the path.

Push a closepath element onto the path.

Get the path elements.

Iterate over the path segments.

The iterator returns the index within the path and the segment.

Get the segment at the given index.

Returns true if the path contains no segments.

Apply an affine transform to the path.

Compute the total arclength.

Here, accuracy specifies the accuracy for each Bézier segment. At worst, the total error is accuracy times the number of Bézier segments.

Note: this is one of the methods that could be implemented on an iterator of PathEl, to save allocation.

Compute the total signed area.

Find the nearest point.

Panics if path is empty or invalid.

Returns the index of the element, the parameter within that segment, and the square of the distance to the point.

Compute the winding number.

TODO: make sure all the signs are consistent.

Convert the path to an SVG path string representation.

The current implementation doesn’t take any special care to produce a short string (reducing precision, using relative movement).

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
The resulting type after applying the * operator.
Performs the * operation. Read more

Signed area.

TODO: figure out sign convention, see #4.

TODO: clean up duplication with impl method.

Winding number of point.

TODO: figure out sign convention, see #4.

TODO: clean up duplication with impl method.

The iterator resulting from to_bez_path.
Convert to a Bézier path, as an iterator over path elements. Read more
Total length of perimeter.
The smallest rectangle that encloses the shape.
If the shape is stored as a slice of path elements, make that available. Read more
If the shape is a line, make it available.
If the shape is a rectangle, make it available.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.