What mathematical formula does Blender use to calculate Bezier paths?
2 Answers
$\begingroup$
$\endgroup$
1
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.
-
$\begingroup$ How do you generalize this for a curve of n segments? $\endgroup$– IvánCommented Dec 3, 2023 at 8:54
$\begingroup$
$\endgroup$
1
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
-
$\begingroup$ I read that bezier curves commonly are interpolated with Casteljau's algorithm. $\endgroup$ Commented Feb 2, 2014 at 10:38