Struct lyon::bezier::CubicBezierSegment
[−]
[src]
pub struct CubicBezierSegment { pub from: TypedPoint2D<f32, UnknownUnit>, pub ctrl1: TypedPoint2D<f32, UnknownUnit>, pub ctrl2: TypedPoint2D<f32, UnknownUnit>, pub to: TypedPoint2D<f32, UnknownUnit>, }
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: TypedPoint2D<f32, UnknownUnit>
ctrl1: TypedPoint2D<f32, UnknownUnit>
ctrl2: TypedPoint2D<f32, UnknownUnit>
to: TypedPoint2D<f32, UnknownUnit>
Methods
impl CubicBezierSegment
[src]
fn sample(&self, t: f32) -> TypedPoint2D<f32, UnknownUnit>
[src]
Sample the curve at t (expecting t between 0 and 1).
fn sample_x(&self, t: f32) -> f32
[src]
Sample the x coordinate of the curve at t (expecting t between 0 and 1).
fn sample_y(&self, t: f32) -> f32
[src]
Sample the y coordinate of the curve at t (expecting t between 0 and 1).
fn sample_derivative(&self, t: f32) -> TypedVector2D<f32, UnknownUnit>
[src]
Sample the curve's derivative at t (expecting t between 0 and 1).
fn sample_x_derivative(&self, t: f32) -> f32
[src]
Sample the x coordinate of the curve's derivative at t (expecting t between 0 and 1).
fn sample_y_derivative(&self, t: f32) -> f32
[src]
Sample the y coordinate of the curve's derivative at t (expecting t between 0 and 1).
fn split(&self, t: f32) -> (CubicBezierSegment, CubicBezierSegment)
[src]
Split this curve into two sub-curves.
fn before_split(&self, t: f32) -> CubicBezierSegment
[src]
Return the curve before the split point.
fn after_split(&self, t: f32) -> CubicBezierSegment
[src]
Return the curve after the split point.
fn transform(
&self,
transform: &TypedTransform2D<f32, UnknownUnit, UnknownUnit>
) -> CubicBezierSegment
[src]
&self,
transform: &TypedTransform2D<f32, UnknownUnit, UnknownUnit>
) -> CubicBezierSegment
Applies the transform to this curve and returns the results.
fn flattened(&self, tolerance: f32) -> Flattened
[src]
Returns the flattened representation of the curve as an iterator, starting after the current point.
fn flattened_for_each<F>(&self, tolerance: f32, call_back: &mut F) where
F: FnMut(TypedPoint2D<f32, UnknownUnit>) -> (),
[src]
F: FnMut(TypedPoint2D<f32, UnknownUnit>) -> (),
Iterates through the curve invoking a callback at each point.
fn compute_length(&self, tolerance: f32) -> f32
[src]
Compute the length of the segment using a flattened approximation.
fn find_inflection_points(&self) -> ArrayVec<[f32; 2]>
[src]
fn find_local_x_extrema(&self) -> ArrayVec<[f32; 2]>
[src]
Return local x extrema or None if this curve is monotone.
This returns the advancements along the curve, not the actual x position.
fn find_local_y_extrema(&self) -> ArrayVec<[f32; 2]>
[src]
Return local y extrema or None if this curve is monotone.
This returns the advancements along the curve, not the actual y position.
fn find_y_maximum(&self) -> f32
[src]
Find the advancement of the y-most position in the curve.
This returns the advancement along the curve, not the actual y position.
fn find_y_minimum(&self) -> f32
[src]
Find the advancement of the y-least position in the curve.
This returns the advancement along the curve, not the actual y position.
fn find_x_maximum(&self) -> f32
[src]
Find the advancement of the x-most position in the curve.
This returns the advancement along the curve, not the actual x position.
fn find_x_minimum(&self) -> f32
[src]
Find the x-least position in the curve.
fn bounding_rect(&self) -> TypedRect<f32, UnknownUnit>
[src]
Returns a rectangle the curve is contained in
fn minimum_bounding_rect(&self) -> TypedRect<f32, UnknownUnit>
[src]
Returns the smallest rectangle the curve is contained in
fn assume_x_montone(&self) -> XMonotoneCubicBezierSegment
[src]
Cast this curve into a x-montone curve without checking that the monotonicity assumption is correct.
fn assume_y_montone(&self) -> YMonotoneCubicBezierSegment
[src]
Cast this curve into a y-montone curve without checking that the monotonicity assumption is correct.
fn line_intersections(
&self,
line: &Line
) -> ArrayVec<[TypedPoint2D<f32, UnknownUnit>; 3]>
[src]
&self,
line: &Line
) -> ArrayVec<[TypedPoint2D<f32, UnknownUnit>; 3]>
fn line_segment_intersections(
&self,
segment: &LineSegment
) -> ArrayVec<[TypedPoint2D<f32, UnknownUnit>; 3]>
[src]
&self,
segment: &LineSegment
) -> ArrayVec<[TypedPoint2D<f32, UnknownUnit>; 3]>