A cubic Bezier curve can be expressed in the following form: $$P(t) = GBT(t) = \left[ {\begin{array}{*{20}{c}} {{P_1}}&{{P_2}}&{{P_3}}&{{P_4}} \end{array}} \right]\left[ {\begin{array}{*{20}{c}} 1&{ - 3}&3&{ - 1}\\ 0&3&{ - 6}&3\\ 0&0&3&{ - 3}\\ 0&0&0&1 \end{array}} \right]\left[ {\begin{array}{*{20}{c}} 1\\ t\\ {{t^2}}\\ {{t^3}} \end{array}} \right]$$where $G$ is a vector of $4$ control points, $B$ is a matrix of Bernstein polynomial coefficients and $T$ is a time vector.

The task is to derive the spline matrix (similar to $B$) for a cubic spline $P(t)$ that satisfies the following conditions:

  1. It interpolates the first control point ${P_1}$ at time $t = 0$.
  2. Its tangent $P'(t)$ at $t = 0$ matches $3 \cdot ({P_2} - {P_1})$ like a cubic Bezier curve.
  3. It interpolates the third and fourth control points such that $P(2/3) = {P_3}$ and $P(1) = {P_4}$.

I know that i have to use the constraints to construct a system of linear equations. However, i'm having problems with building such system.


1 Answer 1


The general equation for a cubic curve is $at^3+bt^2+ct+d.$ Thus, we must simply equate our given information with this form, then solve the linear system for the coefficients. $$\begin{cases} P(0) = d = P_1\\ P'(0) = c = 3(P_2-P_1)\\ P\left(\frac23\right) = a\left(\frac23\right)^3+b\left(\frac23\right)^2+c\left(\frac23\right)+d=P_3&\\ P(1) = a+b+c+d=P_4\end{cases}$$

Can you construct the matrices and solve this the rest of the way?

It seems like your confused about the $P_1, P_2, \cdots$. These are just constants in the matrix, and should be treated exactly the same as you would treat any other constant. Your variables, which you are solving for, are $a, b, c, \text{ and } d$.

The matrix you end up with should be:

$$\begin{matrix}a & b & c & d& &&&&\\\end{matrix}\\ \left[\begin{array}{rrrr|r} 0 & 0 & 0 & 1 & P_1\\ 0 & 0 & 1 & 0 & 3(P_2-P_1)\\ \frac{8}{27} & \frac49 & \frac23 & 1 & P_3\\ 1 & 1 & 1 & 1 & P_4\\ \end{array}\right]$$

  • $\begingroup$ I got the same expression but having problem collecting all coefficients into a matrix. We are solving for coefficients $a,b,c,d$ but what we do with ${P_1},{P_2},{P_3},{P_4}$. I see 4 equations with 8 unknowns or how do we deal with $P$? $\endgroup$
    – user_777
    Oct 24, 2017 at 0:09
  • $\begingroup$ you can make this system into an augmented matrix, a la linear algebra 101, right? $\endgroup$ Oct 24, 2017 at 0:10
  • $\begingroup$ How can you leave $3({P_2} - {P_1})$ instead of ${P_2}$? $\endgroup$
    – user_777
    Oct 24, 2017 at 0:25
  • $\begingroup$ In your system of equations, $c$ is not equal to $P_2$, but rather $3(P_2-P_1)$ as you stated in your list of conditions. If you wanted to make $P'(0)=P_2$, you would want to replace $3(P_2-P_1)$ with $P_2$. $\endgroup$ Oct 24, 2017 at 0:27

You must log in to answer this question.

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