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: PointImplementations§
Source§impl CubicBez
impl CubicBez
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(
&self,
) -> ArrayVec<f64, kurbo::::cubicbez::{impl#9}::extrema::{constant#0}>
fn extrema( &self, ) -> ArrayVec<f64, kurbo::::cubicbez::{impl#9}::extrema::{constant#0}>
Source§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}>
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§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.