



Description

The Draft CubicBezCurve 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 control points 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.

Spline defined by three cubic Bezier segments. Each cubic Bezier is defined by four points, but when the tool is used graphically, only three such points are placed: 1-2-3 for the first segment, 3-4-5 for the second segment, and 5-6-7 for the third segment; the fourth point in each segment is defined implicitly; the last point 8 is necessary to finish the operation, and would be part of a fourth Bezier segment if the operation is continued.





Usage

Press the Draft CubicBezCurve Click a first point on the 3D view, and hold the mouse button (1); this is the first end point. Drag the pointer to another point on the 3D view, and release the mouse button (2); this is the first control point. 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. 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). At this moment you already have one Bezier curve of 3rd degree. The command can be completed by pressing Esc or the Close 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.

Notes

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| 1 |c-h -- r -- c-h -- r| 2 |c-h -- r -- c-h -- r| 3 |c-h -- r -- c-h -- r| 4

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 Edit. 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 Draft.makeBezCurve() must be used. See the Scripting section.

Options

See the options in Draft BezCurve.

Properties

See the properties in Draft BezCurve.

Scripting

See also: Draft API and FreeCAD Scripting Basics.

See Draft BezCurve for the general information. A cubic Bezier is created by passing the option degree=3 to makeBezCurve() .

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 3n + 1 or 3n , where n is the number of segments, for n >= 1 .

Examples of Bezier curves produced by using 2, 3, 4, 5, 6, 7, and 8 points. The solid lines indicate cubic Bezier segments; the other lines are quadratic or linear.



Example: