pub struct QuadBez {
pub p0: Point,
pub p1: Point,
pub p2: Point,
}Expand description
A single quadratic Bézier segment.
Fields§
§p0: Point§p1: Point§p2: PointImplementations§
Source§impl QuadBez
impl QuadBez
Sourcepub fn new<V: Into<Point>>(p0: V, p1: V, p2: V) -> QuadBez
pub fn new<V: Into<Point>>(p0: V, p1: V, p2: V) -> QuadBez
Create a new quadratic Bézier segment.
Sourcepub fn raise(&self) -> CubicBez
pub fn raise(&self) -> CubicBez
Raise the order by 1.
Returns a cubic Bézier segment that exactly represents this quadratic.
Sourcepub(crate) fn estimate_subdiv(&self, sqrt_tol: f64) -> FlattenParams
pub(crate) fn estimate_subdiv(&self, sqrt_tol: f64) -> FlattenParams
Estimate the number of subdivisions for flattening.
pub(crate) fn determine_subdiv_t(&self, params: &FlattenParams, x: f64) -> f64
Sourcepub(crate) fn solve_monotonic_for_y(&self, y: f64) -> f64
pub(crate) fn solve_monotonic_for_y(&self, y: f64) -> f64
Finds the value of t for which self.eval(t) is about y.
Assumes that this segment is monotonic in y and that it crosses
the height y. (Under these assumptions, there is a unique answer.)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for QuadBez
impl<'de> Deserialize<'de> for QuadBez
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 Mul<QuadBez> for TranslateScale
impl Mul<QuadBez> for TranslateScale
Source§impl ParamCurve for QuadBez
impl ParamCurve for QuadBez
Source§impl ParamCurveArclen for QuadBez
impl ParamCurveArclen for QuadBez
Source§fn arclen(&self, _accuracy: f64) -> f64
fn arclen(&self, _accuracy: f64) -> f64
Arclength of a quadratic Bézier segment.
This computation is based on an analytical formula. Since that formula suffers from numerical instability when the curve is very close to a straight line, we detect that case and fall back to Legendre-Gauss quadrature.
Accuracy should be better than 1e-13 over the entire range.
Adapted from http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/ with permission.
Source§impl ParamCurveArea for QuadBez
impl ParamCurveArea for QuadBez
Source§fn signed_area(&self) -> f64
fn signed_area(&self) -> f64
Source§impl ParamCurveCurvature for QuadBez
impl ParamCurveCurvature for QuadBez
Source§impl ParamCurveDeriv for QuadBez
impl ParamCurveDeriv for QuadBez
Source§impl ParamCurveExtrema for QuadBez
impl ParamCurveExtrema for QuadBez
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 QuadBez
impl ParamCurveNearest for QuadBez
Source§impl Shape for QuadBez
impl Shape for QuadBez
Source§type PathElementsIter<'iter> = QuadBezIter
type PathElementsIter<'iter> = QuadBezIter
path_elements method.