Struct CubicBez
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§
§impl CubicBez
impl CubicBez
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.
pub 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§
§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<'iter> = CubicBezIter
type PathElementsIter<'iter> = CubicBezIter
path_elements method.§fn path_elements(&self, _tolerance: f64) -> CubicBezIter ⓘ
fn path_elements(&self, _tolerance: f64) -> CubicBezIter ⓘ
§fn bounding_box(&self) -> Rect
fn bounding_box(&self) -> Rect
§fn into_path(self, tolerance: f64) -> BezPathwhere
Self: Sized,
fn into_path(self, tolerance: f64) -> BezPathwhere
Self: Sized,
§fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter<'_>> ⓘ
fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter<'_>> ⓘ
§fn as_rounded_rect(&self) -> Option<RoundedRect>
fn as_rounded_rect(&self) -> Option<RoundedRect>
§fn as_path_slice(&self) -> Option<&[PathEl]>
fn as_path_slice(&self) -> Option<&[PathEl]>
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 UnsafeUnpin for CubicBez
impl UnwindSafe for CubicBez
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more