Draft CubicBezCurve

Description
The tool creates a Bezier Curve of third degree (four points required). This is one of the most commonly used curves in computer graphics applications. This tool allows you to create a big spline made of several 3rd-degree Bezier segments, in a way that is similar to the Bezier tool in Inkscape. A general Bezier curve of any degree can be created with Draft BezCurve.

The Draft BezCurve and the Draft CubicBezCurve tools use to define the position and curvature of the spline; on the other hand the Draft BSpline tool specifies the exact points through which the curve will go.



Usage

 * 1) Press the  button.
 * 2) Click a first point on the 3D view, and hold the mouse button (1); this is the first end point.
 * 3) Drag the pointer to another point on the 3D view, and release the mouse button (2); this is the first control point.
 * 4) Move the pointer to another point on the 3D view, and click and hold the mouse button on this point (3); this is the second end point.
 * 5) Move the pointer to another point on the 3D view to adjust the final curvature of the spline, and then release the mouse button (4).
 * 6) At this moment you already have one Bezier curve of 3rd degree. The command can be completed by pressing  or the  button, or you may repeat the process of clicking and holding (5), and dragging and releasing (6) to add more 3rd-degree Bezier segments.

Note that with this workflow you need two click-hold-release sequences to create a single Bezier curve of third degree.
 * The first click-hold defines the first end point.
 * The first release defines the first control point.
 * The second click-hold defines the second end point, and the general direction of the spline.
 * The second release defines the final curvature of the spline.
 * The second control point is not explicitly given, but is determined from the location of the pointer during the second release.

Creating several Bezier segments

 * The second release also correspond to the first control point of the subsequent Bezier curve.
 * This means that the second click-hold was also the first end point of the second Bezier curve.
 * A third click-hold would be the second end point.
 * A third release would define the final curvature of the second curve, and it would also be the first control point of a third curve.

This means that for every two click-hold (c-h) and release (r) sequences, the second sequence is already part of a subsequent curve segment, as indicated in the following graphic:

|c-h -- r -- c-h -- r| 2 |c-h -- r -- c-h -- r| 3 |c-h -- r -- c-h -- r| 4
 * c-h -- r -- c-h -- r| 1

How to exactly place the control points
The graphical operation of this tool only allows the user to specify the first control point of the curve when it is being drawn. The second control point can be adjusted after the object is created: double click on the curve object in tree view, or select it and press. Then drag the second control point to the desired position.

In order to choose exactly both end points and both control points, the Python command must be used. See the Scripting section.

Options
See the options in Draft BezCurve.

Properties
See the properties in Draft BezCurve.

Scripting
Draft API and FreeCAD Scripting Basics.

See Draft BezCurve for the general information. A cubic Bezier is created by passing the option  to.

For each cubic Bezier segment four points must be used, of which the two extreme points indicate where the spline passes through, and the two intermediate points are control points.
 * If only 3 points are given, it creates a quadratic Bezier instead, with only one control point.
 * If only 2 points are given, it creates a linear Bezier, that is, a straight line.
 * If 5 points are given, the first 4 create a cubic Bezier segment; the 4th and the 5th points are used to create a straight line.
 * If 6 points are given, the first 4 create a cubic Bezier segment; the 4th and the other two points are used to create a quadratic Bezier segment.
 * If 7 points are given, the first 4 create a cubic Bezier segment; the 4th and the other three points are used to create a second cubic Bezier segment.
 * In general, the last point in a group of four is shared with the following three points maximum to create another Bezier segment.
 * To have smooth curves, with no straight segments, the number of points should be or, where  is the number of segments, for.



Example: