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.
sourcepub fn tangents_to_point(&self, p: Point) -> ArrayVec<f64, 4>
pub fn tangents_to_point(&self, p: Point) -> ArrayVec<f64, 4>
Find points on the curve where the tangent line passes through the given point.
Result is array of t values such that the tangent line from the curve evaluated at that point goes through the argument point.
Trait Implementations§
source§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 Shape for CubicBez
impl Shape for CubicBez
source§type PathElementsIter<'iter> = CubicBezIter
type PathElementsIter<'iter> = CubicBezIter
path_elements
method.source§fn path_elements(&self, _tolerance: f64) -> CubicBezIter ⓘ
fn path_elements(&self, _tolerance: f64) -> CubicBezIter ⓘ
source§fn bounding_box(&self) -> Rect
fn bounding_box(&self) -> Rect
source§fn into_path(self, tolerance: f64) -> BezPathwhere
Self: Sized,
fn into_path(self, tolerance: f64) -> BezPathwhere
Self: Sized,
source§fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter<'_>> ⓘ
fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter<'_>> ⓘ
source§fn as_rounded_rect(&self) -> Option<RoundedRect>
fn as_rounded_rect(&self) -> Option<RoundedRect>
impl Copy for CubicBez
impl StructuralPartialEq for CubicBez
Auto Trait Implementations§
impl Freeze for CubicBez
impl RefUnwindSafe for CubicBez
impl Send for CubicBez
impl Sync for CubicBez
impl Unpin for CubicBez
impl UnwindSafe for CubicBez
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)