0
$\begingroup$

I have a Hermite cubic in the form of the standard cubic equation of $y=ax^3+bx^2+cx+d$, and this works well for my interpolation needs, but now I want to create Bezier curves from the Hermite cubics. I struggle to find a way to transform a Hermite cubic into a Bezier curve.

I've followed Joshua Barczak's blog about transforming a Hermite curve into a Bezier curve, and this seems to work, but I only end up with Bezier curves that are lines after doing this for x and y. For example, a Hermite cubic given (0, 0) and (1, 1) with $f'(0)=0$ and $f'(1)=0$ aka $y=-2x^3+3x^2$ transforms into this green curve. Another example would be a Hermite cubic given (-1, 0) and (1, 2) with $f'(-1)=0$ and $f'(1)=0$ or the equation $-0.5x^3+1.5x+1$, which is also a line once transformed.

I believe that I am misunderstanding either the Hermite control points, since I do not use a parametrized function, or that I am incorrectly applying Barczak's method, but it seems like it is simply multiplying the inverse Bezier matrix by the Hermite basis matrix by the Hermite control matrix to find the Bezier control matrix.

You can see the actual desmos graph here.

$\endgroup$

1 Answer 1

2
$\begingroup$

Suppose the start and end-points of the cubic are $P_0 = (x_0, y_0)$ and $P_1 = (x_1,y_1)$, and the starting and ending slopes (first derivatives) are $d_0$ and $d_1$.

Then, to express this as a 2D parametric cubic Bezier curve, the control points you use are: $$ (x_0, y_0) \\ \big(\; x_0 + \tfrac13(x_1 - x_0) \; , \; y_0 + \tfrac13d_0(x_1 - x_0) \;\big) \\ \big(\; x_1 - \tfrac13(x_1 - x_0) \; , \; y_1 - \tfrac13d_1(x_1 - x_0) \;\big) \\ (x_1, y_1) $$

$\endgroup$
2
  • $\begingroup$ I think the change in $y$ in the middle two points should by $\pm d_j\,\Delta x/3$, no? $\endgroup$
    – Michael E2
    Commented Jul 6, 2022 at 14:04
  • $\begingroup$ Yes, you’re right. I fixed it. Thanks. $\endgroup$
    – bubba
    Commented Jul 6, 2022 at 23:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .