Struct lyon_geom::QuadraticBezierSegment [−][src]
Expand description
A 2d curve segment defined by three points: the beginning of the segment, a control point and the end of the segment.
The curve is defined by equation:
∀ t ∈ [0..1], P(t) = (1 - t)² * from + 2 * (1 - t) * t * ctrl + 2 * t² * to
Fields
from: Point<S>
ctrl: Point<S>
to: Point<S>
Implementations
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).
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).
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.
Return the y inflection point or None if this curve is y-monotonic.
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 advancement of the x-least position in the curve.
This returns the advancement along the curve, not the actual x position.
Return the x inflection point or None if this curve is x-monotonic.
Return the sub-curve inside a given range of t.
This is equivalent 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.
Elevate this curve to a third order bézier.
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.
Find the interval of the beginning of the curve that can be approximated with a line segment.
Compute a flattened approximation of the curve, invoking a callback at each step.
The callback takes the point on the curve at each step.
This implements the algorithm described by Raph Levien at https://raphlinus.github.io/graphics/curves/2019/12/23/flatten-quadbez.html
Compute a flattened approximation of the curve, invoking a callback at each step.
The callback takes the curve parameter at each step.
This implements the algorithm described by Raph Levien at https://raphlinus.github.io/graphics/curves/2019/12/23/flatten-quadbez.html
pub fn for_each_flattened_with_t<F>(&self, tolerance: S, callback: &mut F) where
F: FnMut(Point<S>, S),
pub fn for_each_flattened_with_t<F>(&self, tolerance: S, callback: &mut F) where
F: FnMut(Point<S>, S),
Compute a flattened approximation of the curve, invoking a callback at each step.
The callback takes the point and corresponding curve parameter at each step.
This implements the algorithm described by Raph Levien at https://raphlinus.github.io/graphics/curves/2019/12/23/flatten-quadbez.html
Returns the flattened representation of the curve as an iterator, starting after the current point.
pub fn flattened_t(&self, tolerance: S) -> FlattenedT<S>ⓘNotable traits for FlattenedT<S>
impl<S: Scalar> Iterator for FlattenedT<S> type Item = S;
pub fn flattened_t(&self, tolerance: S) -> FlattenedT<S>ⓘNotable traits for FlattenedT<S>
impl<S: Scalar> Iterator for FlattenedT<S> type Item = S;
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..
pub fn for_each_monotonic<F>(&self, cb: &mut F) where
F: FnMut(&Monotonic<QuadraticBezierSegment<S>>),
Compute the length of the segment using a flattened approximation.
Returns a triangle containing this curve segment.
Returns a conservative rectangle that contains the curve.
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 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 a line.
Computes the intersections (if any) between this segment 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.
Computes the intersection points (if any) between this segment a line segment.
Trait Implementations
Performs the conversion.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<S> RefUnwindSafe for QuadraticBezierSegment<S> where
S: RefUnwindSafe,
impl<S> Send for QuadraticBezierSegment<S> where
S: Send,
impl<S> Sync for QuadraticBezierSegment<S> where
S: Sync,
impl<S> Unpin for QuadraticBezierSegment<S> where
S: Unpin,
impl<S> UnwindSafe for QuadraticBezierSegment<S> where
S: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more