pub struct CubicBez {
pub p0: Point,
pub p1: Point,
pub p2: Point,
pub p3: Point,
}
Expand description
A single cubic Bézier segment.
Fields§
§p0: Point
§p1: Point
§p2: Point
§p3: Point
Implementations§
§impl CubicBez
impl CubicBez
pub fn new<P>(p0: P, p1: P, p2: P, p3: P) -> CubicBezwhere
P: Into<Point>,
pub fn new<P>(p0: P, p1: P, p2: P, p3: P) -> CubicBezwhere P: Into<Point>,
Create a new cubic Bézier segment.
pub fn to_quads(
&self,
accuracy: f64
) -> impl Iterator<Item = (f64, f64, QuadBez)>
pub fn to_quads( &self, accuracy: f64 ) -> impl Iterator<Item = (f64, f64, QuadBez)>
Convert to quadratic Béziers.
The iterator returns the start and end parameter in the cubic of each quadratic segment, along with the quadratic.
Note that the resulting quadratic Béziers are not in general G1 continuous; they are optimized for minimizing distance error.
This iterator will always produce at least one QuadBez
.
pub fn approx_spline(&self, accuracy: f64) -> Option<QuadSpline>
pub fn approx_spline(&self, accuracy: f64) -> Option<QuadSpline>
Return a QuadSpline
approximating this cubic Bézier.
Returns None
if no suitable approximation is found within the given
tolerance.
pub fn inflections(&self) -> ArrayVec<f64, 2>
pub fn inflections(&self) -> ArrayVec<f64, 2>
Determine the inflection points.
Return value is t parameter for the inflection points of the curve segment. There are a maximum of two for a cubic Bézier.
See https://www.caffeineowl.com/graphics/2d/vectorial/cubic-inflexion.html for the theory.
Trait Implementations§
§impl Mul<CubicBez> for TranslateScale
impl Mul<CubicBez> for TranslateScale
§impl ParamCurve for CubicBez
impl ParamCurve for CubicBez
§fn subsegment(&self, range: Range<f64>) -> CubicBez
fn subsegment(&self, range: Range<f64>) -> CubicBez
§impl ParamCurveArclen for CubicBez
impl ParamCurveArclen for CubicBez
§impl ParamCurveArea for CubicBez
impl ParamCurveArea for CubicBez
§fn signed_area(&self) -> f64
fn signed_area(&self) -> f64
§impl ParamCurveCurvature for CubicBez
impl ParamCurveCurvature for CubicBez
§impl ParamCurveDeriv for CubicBez
impl ParamCurveDeriv for CubicBez
§impl ParamCurveExtrema for CubicBez
impl ParamCurveExtrema for CubicBez
§fn extrema(
&self
) -> ArrayVec<f64, kurbo::::cubicbez::{impl#9}::extrema::{constant#0}>
fn extrema( &self ) -> ArrayVec<f64, kurbo::::cubicbez::{impl#9}::extrema::{constant#0}>
§fn extrema_ranges(
&self
) -> ArrayVec<Range<f64>, kurbo::::param_curve::ParamCurveExtrema::extrema_ranges::{constant#0}>
fn extrema_ranges( &self ) -> ArrayVec<Range<f64>, kurbo::::param_curve::ParamCurveExtrema::extrema_ranges::{constant#0}>
§fn bounding_box(&self) -> Rect
fn bounding_box(&self) -> Rect
§impl ParamCurveNearest for CubicBez
impl ParamCurveNearest for CubicBez
§impl Shape for CubicBez
impl Shape for CubicBez
§type PathElementsIter = CubicBezIter
type PathElementsIter = CubicBezIter
path_elements
method.