Struct lyon_bezier::QuadraticBezierSegment
[−]
[src]
pub struct QuadraticBezierSegment { pub from: Point, pub ctrl: Point, pub to: Point, }
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
ctrl: Point
to: Point
Methods
impl QuadraticBezierSegment
[src]
fn sample(&self, t: f32) -> Point
Sample the curve at t (expecting t between 0 and 1).
fn sample_x(&self, t: f32) -> f32
Sample the x coordinate of the curve at t (expecting t between 0 and 1).
fn sample_y(&self, t: f32) -> f32
Sample the y coordinate of the curve at t (expecting t between 0 and 1).
fn sample_derivative(&self, t: f32) -> Vec2
Sample the curve's derivative at t (expecting t between 0 and 1).
fn sample_x_derivative(&self, t: f32) -> f32
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
Sample the y coordinate of the curve's derivative at t (expecting t between 0 and 1).
fn flip(&mut self)
Swap the beginning and the end of the segment.
fn find_y_maximum(&self) -> f32
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
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_local_y_extremum(&self) -> Option<f32>
Return the y inflection point or None if this curve is y-monotone.
fn find_x_maximum(&self) -> f32
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
Find the advancement of the x-least position in the curve.
This returns the advancement along the curve, not the actual x position.
fn find_local_x_extremum(&self) -> Option<f32>
Return the x inflection point or None if this curve is x-monotone.
fn split(&self, t: f32) -> (QuadraticBezierSegment, QuadraticBezierSegment)
Split this curve into two sub-curves.
fn before_split(&self, t: f32) -> QuadraticBezierSegment
Return the curve before the split point.
fn after_split(&self, t: f32) -> QuadraticBezierSegment
Return the curve after the split point.
fn to_cubic(&self) -> CubicBezierSegment
Elevate this curve to a third order bézier.
fn transform(&self, transform: &Transform2D) -> Self
Applies the transform to this curve and returns the results.
fn flattening_step(&self, tolerance: f32) -> f32
Find the interval of the begining of the curve that can be approximated with a line segment.
fn flattened_for_each<F: FnMut(Point)>(&self, tolerance: f32, call_back: &mut F)
Iterates through the curve invoking a callback at each point.
fn flattening_iter(&self, tolerance: f32) -> QuadraticFlatteningIter
Returns the flattened representation of the curve as an iterator, starting after the current point.
fn compute_length(&self, tolerance: f32) -> f32
Compute the length of the segment using a flattened approximation.
fn bounding_triangle(&self) -> Triangle
Returns a triangle containing this curve segment.
fn bounding_rect(&self) -> Rect
Returns a rectangle the curve is contained in
fn minimum_bounding_rect(&self) -> Rect
Returns the smallest rectangle the curve is contained in
fn assume_x_montone(&self) -> XMonotoneQuadraticBezierSegment
Cast this curve into a x-montone curve without checking that the monotonicity assumption is correct.
fn assume_y_montone(&self) -> YMonotoneQuadraticBezierSegment
Cast this curve into a y-montone curve without checking that the monotonicity assumption is correct.
fn line_intersections(&self, line: &Line) -> ArrayVec<[Point; 2]>
fn line_segment_intersections(
&self,
segment: &LineSegment
) -> ArrayVec<[Point; 2]>
&self,
segment: &LineSegment
) -> ArrayVec<[Point; 2]>
Trait Implementations
impl Copy for QuadraticBezierSegment
[src]
impl Clone for QuadraticBezierSegment
[src]
fn clone(&self) -> QuadraticBezierSegment
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more