Phone: 905 409-1589
Email: info@penproductions.ca
RSS LinkedIn Twitter Twitter
Bezier Curves
Linear Interpolation:
Bezier curves start with a simple principal, linear interpolation between two points. With this one simple piece of math we can derive complex curves by refining the method.

On the right we can see a simple linear interpolation between points P0 and P1 by Q0 using time (t). The math is a simple equation where we get the world offset using (P1-P0) and then multiply it by the time along the curve. Time in this case is a value from 0 to 1 where 0 will set Q0 at P0 and 1 will set Q0 at P1 (P1-P0)*t. Then we need to move that vector back into the space of P0 by adding it back (P1-P0)*t+P0. The final equation looks like this.

Equation:
Q0 = (P1 - P0) * t + P0

This linear interpolation can be used for many different applications in 3D where you need to project a point along an imaginary line. Note that values below 0 and above 1 also work.

More information can be found here.. Bezier Curves

Quadratic & Higher-Order Bezier Curves:
In the example below we can see a Cubic Bezier that demomstrates how simple Linear Interpolation can be used to derive a Bezier curve.

The problem with using this method is it can get slow when calculating many control points.

Number of calculations:
numControlPoints=4
numCalculations=0
for i = 1 to numControlPoints-1 do numCalculations+=i
format "Number Points: %\t Calculations: %\n" numControlPoints numCalculations

Number Points: 2 Calculations: 1 Number Points: 3 Calculations: 3 Number Points: 4 Calculations: 6 Number Points: 5 Calculations: 10 Number Points: 6 Calculations: 15 Number Points: 7 Calculations: 21 Number Points: 8 Calculations: 28 Number Points: 9 Calculations: 36 Number Points: 10 Calculations: 45
Number Points: 11 Calculations: 55 Number Points: 12 Calculations: 66 Number Points: 13 Calculations: 78 Number Points: 14 Calculations: 91 Number Points: 15 Calculations: 105 Number Points: 16 Calculations: 120 Number Points: 17 Calculations: 136 Number Points: 18 Calculations: 153 Number Points: 19 Calculations: 171 Number Points: 20 Calculations: 190

Bezier Curves:
Below is a comparision of a Cubic Bezier and a Bezier Spline solution using multiple Cubic interpolations.

With this solution the number of points isn't affecting the calculation speed. The way that this works is it first finds the segment of the spline that the time value resides in and then calculates a Cubic Bezier solution for it. That is the first knot (P0), out tangent (P1), in tangent (P2) and last knot (P3).