Skip to content

Quadratic Bezier Curves #203

@MaxDeVos

Description

@MaxDeVos

Disclaimer: I feel as though I am missing something fundamental here, that some existing component already serves this purpose and I don't know it.

Is there a reason that quadratic Bezier curves are not explicitly supported by this library? The BezierCurve2 class explicitly excludes them, likely due to not having a valid result for GetThirdDerivative(double t). I see three potential solutions to this:

  1. BezierCurve2 is modified to automatically convert quadratic bezier curves to cubic ones by calculating control point 1, which can be done as follows:
$$\begin{align*} C_0 &= Q_0 \\\ C_1 &= Q_0 + \frac{2}{3}(Q_1-Q_0) \\\ C_2 &= Q_2 + \frac{2}{3}(Q_1-Q_2) \\\ C_3 &= Q_2 \end{align*}$$
  1. QuadraticBezierCurve2 is added and its implementation of GetThirdDerivative(t) always returns double.NaN.
  2. BezierCurve2 is modified to natively support quadratic bezier curves, but the boolean property isQuadratic is added, and GetThirdDerivative(t) returns double.NaN when the curve is quadratic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions