15
$\begingroup$

What mathematical formula does Blender use to calculate Bezier paths?

$\endgroup$

2 Answers 2

15
$\begingroup$

For each segment of the path between two control points, it approximates a cubic Bezier curve:

Bezier Curve formula

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

Visual control points

$\endgroup$
10
$\begingroup$

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:
    See BKE_mask_point_segment_co (trivial to adapt for 3D curves too).
  • 3D curves use an optimized (less straightforward), fixed step, subdivision method:
    See BKE_curve_forward_diff_bezier

To see how this method works, see wikipedia's description of Higher order curves

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.