pub struct CubicBez {
pub p0: Point,
pub p1: Point,
pub p2: Point,
pub p3: Point,
}Expand description
Cubic Bézier curve.
Fields§
§p0: PointStart point.
p1: PointFirst control point.
p2: PointSecond control point.
p3: PointEnd point.
Implementations§
Source§impl CubicBez
impl CubicBez
Sourcepub fn subsegment(self, t0: f64, t1: f64) -> Self
pub fn subsegment(self, t0: f64, t1: f64) -> Self
Sub-curve between t0 and t1.
Sourcepub fn flatness(self) -> f64
pub fn flatness(self) -> f64
Maximum distance of the control points from the chord (flatness bound).
Sourcepub fn flatten_into(self, tol: f64, out: &mut Vec<Point>)
pub fn flatten_into(self, tol: f64, out: &mut Vec<Point>)
Append a polyline approximation (excluding the start point) to out.
Sourcepub fn length(self, rel: f64) -> f64
pub fn length(self, rel: f64) -> f64
Arc length with adaptive Gauss–Legendre quadrature (relative accuracy ≈ rel).
Sourcepub fn closest(self, p: Point) -> (f64, Point)
pub fn closest(self, p: Point) -> (f64, Point)
Closest point (parameter, point).
Global search by branch-and-bound subdivision (the control-polygon box is a lower bound for every sub-curve), followed by Newton polishing. This cannot get trapped in a local minimum the way pure sampling + Newton can.
Trait Implementations§
impl Copy for CubicBez
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>,
Deserialize this value from the given Serde deserializer. Read more
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§
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
Mutably borrows from an owned value. Read more