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§
source§impl CubicBez
impl CubicBez
sourcepub fn new<P: Into<Point>>(p0: P, p1: P, p2: P, p3: P) -> CubicBez
pub fn new<P: Into<Point>>(p0: P, p1: P, p2: P, p3: P) -> CubicBez
Create a new cubic Bézier segment.
sourcepub 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
.
sourcepub 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.
sourcepub 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§
source§impl<'de> Deserialize<'de> for CubicBez
impl<'de> Deserialize<'de> for CubicBez
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl JsonSchema for CubicBez
impl JsonSchema for CubicBez
source§fn schema_name() -> String
fn schema_name() -> String
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moresource§impl Mul<CubicBez> for TranslateScale
impl Mul<CubicBez> for TranslateScale
source§impl ParamCurve for CubicBez
impl ParamCurve for CubicBez
source§impl ParamCurveArclen for CubicBez
impl ParamCurveArclen for CubicBez
source§impl ParamCurveArea for CubicBez
impl ParamCurveArea for CubicBez
source§fn signed_area(&self) -> f64
fn signed_area(&self) -> f64
source§impl ParamCurveCurvature for CubicBez
impl ParamCurveCurvature for CubicBez
source§impl ParamCurveDeriv for CubicBez
impl ParamCurveDeriv for CubicBez
source§impl ParamCurveExtrema for CubicBez
impl ParamCurveExtrema for CubicBez
source§fn extrema_ranges(&self) -> ArrayVec<Range<f64>, { _ }>
fn extrema_ranges(&self) -> ArrayVec<Range<f64>, { _ }>
source§fn bounding_box(&self) -> Rect
fn bounding_box(&self) -> Rect
source§impl ParamCurveNearest for CubicBez
impl ParamCurveNearest for CubicBez
source§impl PartialEq<CubicBez> for CubicBez
impl PartialEq<CubicBez> for CubicBez
source§impl Shape for CubicBez
impl Shape for CubicBez
§type PathElementsIter<'iter> = CubicBezIter
type PathElementsIter<'iter> = CubicBezIter
path_elements
method.