Struct rasterize::Quad [−][src]
Quadratic bezier curve
Polynimial form:
(1 - t) ^ 2 * p0 + 2 * (1 - t) * t * p1 + t ^ 2 * p2
Matrix from:
┌ ┐ ┌ ┐
┌ ┐ │ 1 0 0 │ │ p0 │
│ 1 t t^2 │ │ -2 2 0 │ │ p1 │
└ ┘ │ 1 -2 1 │ │ p2 │
└ ┘ └ ┘
Implementations
impl Quad
[src]
impl Quad
[src]pub fn new(
p0: impl Into<Point>,
p1: impl Into<Point>,
p2: impl Into<Point>
) -> Self
[src]
p0: impl Into<Point>,
p1: impl Into<Point>,
p2: impl Into<Point>
) -> Self
Create new quadratic bezier curve
pub fn points(&self) -> [Point; 3]
[src]
Points defining quadratic bezier curve
pub fn ends(&self) -> (Line, Line)
[src]
Tanget lines at the ends of the quadratic bezier curve
pub fn smooth(&self) -> Point
[src]
Find smooth point used by SVG parser
Trait Implementations
impl Curve for Quad
[src]
impl Curve for Quad
[src]fn flatness(&self) -> Scalar
[src]
Flattness criteria for the cubic curve
It is equal to f = max d(t) where d(t) = |q(t) - l(t)|, l(t) = (1 - t) * p0 + t * p2
for q(t) bezier2 curve with p{0..2} control points, in other words maximum distance
from parametric line to bezier2 curve for the same parameter t.
Line can be represented as bezier2 curve, if p1 = (p0 + p2) / 2.0
.
Grouping polynomial coofficients:
q(t) = t^2 p2 + 2 (1 - t) t p1 + (1 - t)^2 p0
l(t) = t^2 p2 + (1 - t) t (p0 + p2) + (1 - t)^2 p0
d(t) = |q(t) - l(t)| = (1 - t) t |2 * p1 - p0 - p2|
f = 1 / 4 * | 2 p1 - p0 - p2 |
f^2 = 1/16 |2 * p1 - p0 - p2|^2
fn transform(&self, tr: Transform) -> Self
[src]
fn start(&self) -> Point
[src]
fn end(&self) -> Point
[src]
fn at(&self, t: Scalar) -> Point
[src]
fn deriv(&self) -> Segment
[src]
fn split(&self) -> (Self, Self)
[src]
Optimized version of split_at(0.5)
fn split_at(&self, t: Scalar) -> (Self, Self)
[src]
fn cut(&self, a: Scalar, b: Scalar) -> Self
[src]
fn bbox(&self, init: Option<BBox>) -> BBox
[src]
fn offset(&self, dist: Scalar, out: &mut impl Extend<Segment>)
[src]
fn reverse(&self) -> Self
[src]
fn roots(&self) -> CurveRoots
[src]
fn extremities(&self) -> CurveExtremities
[src]
fn length(&self, t0: Scalar, t1: Scalar) -> Scalar
[src]
fn flatten(&self, tr: Transform, flatness: Scalar) -> CurveFlattenIterⓘNotable traits for CurveFlattenIter
impl Iterator for CurveFlattenIter type Item = Line;
[src]
Notable traits for CurveFlattenIter
impl Iterator for CurveFlattenIter type Item = Line;
fn from_length(&self, l: Scalar, error: Option<Scalar>) -> Scalar
[src]
impl StructuralPartialEq for Quad
[src]
impl StructuralPartialEq for Quad
[src]Auto Trait Implementations
impl RefUnwindSafe for Quad
impl RefUnwindSafe for Quad
impl UnwindSafe for Quad
impl UnwindSafe for Quad