Struct lyon_geom::CubicBezierSegment[][src]

pub struct CubicBezierSegment<S> {
    pub from: Point<S>,
    pub ctrl1: Point<S>,
    pub ctrl2: Point<S>,
    pub to: Point<S>,
}
Expand description

A 2d curve segment defined by four points: the beginning of the segment, two control points and the end of the segment.

The curve is defined by equation:² ∀ t ∈ [0..1], P(t) = (1 - t)³ * from + 3 * (1 - t)² * t * ctrl1 + 3 * t² * (1 - t) * ctrl2 + t³ * to

Fields

from: Point<S>ctrl1: Point<S>ctrl2: Point<S>to: Point<S>

Implementations

Sample the curve at t (expecting t between 0 and 1).

Sample the x coordinate of the curve at t (expecting t between 0 and 1).

Sample the y coordinate of the curve at t (expecting t between 0 and 1).

Return the parameter values corresponding to a given x coordinate. See also solve_t_for_x for monotonic curves.

Return the parameter values corresponding to a given y coordinate. See also solve_t_for_y for monotonic curves.

Sample the curve’s derivative at t (expecting t between 0 and 1).

Sample the x coordinate of the curve’s derivative at t (expecting t between 0 and 1).

Sample the y coordinate of the curve’s derivative at t (expecting t between 0 and 1).

Return the sub-curve inside a given range of t.

This is equivalent to splitting at the range’s end points.

Split this curve into two sub-curves.

Return the curve before the split point.

Return the curve after the split point.

Computes a “fat line” of this segment.

A fat line is two conservative lines between which the segment is fully contained.

Applies the transform to this curve and returns the results.

Swap the beginning and the end of the segment.

Returns the flattened representation of the curve as an iterator, starting after the current point.

Invokes a callback between each monotonic part of the segment.

Invokes a callback for each monotonic part of the segment..

Approximates the cubic bézier curve with sequence of quadratic ones, invoking a callback at each step.

Approximates the cubic bézier curve with sequence of quadratic ones, invoking a callback at each step.

Approximates the cubic bézier curve with sequence of monotonic quadratic ones, invoking a callback at each step.

Iterates through the curve invoking a callback at each point.

Iterates through the curve invoking a callback at each point.

Compute the length of the segment using a flattened approximation.

Return local x extrema or None if this curve is monotonic.

This returns the advancements along the curve, not the actual x position.

Return local y extrema or None if this curve is monotonic.

This returns the advancements along the curve, not the actual y position.

Find the advancement of the y-most position in the curve.

This returns the advancement along the curve, not the actual y position.

Find the advancement of the y-least position in the curve.

This returns the advancement along the curve, not the actual y position.

Find the advancement of the x-most position in the curve.

This returns the advancement along the curve, not the actual x position.

Find the x-least position in the curve.

Returns a conservative rectangle the curve is contained in.

This method is faster than bounding_rect but more conservative.

Returns a conservative range of x this curve is contained in.

Returns a conservative range of y this curve is contained in.

Returns the smallest rectangle the curve is contained in

Returns the smallest range of x this curve is contained in.

Returns the smallest range of y this curve is contained in.

Cast this curve into a monotonic curve without checking that the monotonicity assumption is correct.

Returns whether this segment is monotonic on the x axis.

Returns whether this segment is monotonic on the y axis.

Returns whether this segment is fully monotonic.

Computes the intersections (if any) between this segment and another one.

The result is provided in the form of the t parameters of each point along the curves. To get the intersection points, sample the curves at the corresponding values.

Returns endpoint intersections where an endpoint intersects the interior of the other curve, but not endpoint/endpoint intersections.

Returns no intersections if either curve is a point.

Computes the intersection points (if any) between this segment and another one.

Computes the intersections (if any) between this segment a quadratic bézier segment.

The result is provided in the form of the t parameters of each point along the curves. To get the intersection points, sample the curves at the corresponding values.

Returns endpoint intersections where an endpoint intersects the interior of the other curve, but not endpoint/endpoint intersections.

Returns no intersections if either curve is a point.

Computes the intersection points (if any) between this segment and a quadratic bézier segment.

Computes the intersections (if any) between this segment and a line.

The result is provided in the form of the t parameters of each point along curve. To get the intersection points, sample the curve at the corresponding values.

Computes the intersection points (if any) between this segment and a line.

Computes the intersections (if any) between this segment and a line segment.

The result is provided in the form of the t parameters of each point along curve and segment. To get the intersection points, sample the segments at the corresponding values.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Start of the curve.

End of the curve.

Sample the curve at t (expecting t between 0 and 1).

Sample x at t (expecting t between 0 and 1).

Sample y at t (expecting t between 0 and 1).

Sample the derivative at t (expecting t between 0 and 1).

Sample x derivative at t (expecting t between 0 and 1).

Sample y derivative at t (expecting t between 0 and 1).

Split this curve into two sub-curves.

Return the curve before the split point.

Return the curve after the split point.

Return the curve inside a given range of t. Read more

Swap the direction of the segment.

Compute the length of the segment using a flattened approximation.

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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.