What mathematical formula does Blender use to calculate Bezier paths?
Asked
Active
Viewed 3,256 times
2 Answers
15
For each segment of the path between two control points, it approximates a cubic Bezier curve:

where P0 and P3 are the control points and P1 and P2 are the handles.

-
How do you generalize this for a curve of n segments? – Iván Dec 03 '23 at 08:54
10
Even though this isn't a question about Blender's code exactly, linking to Blender's code for calculating cubic bezier curves may help understanding.
- 2D masks can also use a different (more straightforward but slower) method where you can get any point on along the spline using a factor:
SeeBKE_mask_point_segment_co(trivial to adapt for 3D curves too). - 3D curves use an optimized (less straightforward), fixed step, subdivision method:
SeeBKE_curve_forward_diff_bezier
To see how this method works, see wikipedia's description of Higher order curves
ideasman42
- 47,387
- 10
- 141
- 223
-
I read that bezier curves commonly are interpolated with Casteljau's algorithm. – pink vertex Feb 02 '14 at 10:38