MbBezier3D Bezier Composite Curve

The MbBezier3D class is declared in the cur_bezier3d.h file.

The composite Bézier curve is a derived class of MbPolyCurve3D. The curve is defined by a set of control points SArray<MbCartPoint3D> pointList, by the number splinesCount of Bézier curves, and by the periodicity flag of the curve closed. The curve also has some additional data that is not mandatory and is used to speed up the work of the curve methods.

The curve is constructed based on splinesCount third-degree Bézier curves that are smoothly joined to each other. Each Bézier curve is defined by four control points and passes only through two end points. The composite curve is used to construct a spline passing through given points. The given points serve as the junction points of the third-degree Bézier curves. A pair of internal control points of each third-degree Bézier curve is determined from the condition of smooth joining of the curve with the neighboring curves. For the composite curve, the number of control points is equal to 3(splinesCount + 1). For a non-periodic composite curve, the first pointList and the last control points are not used.

On each third-degree Bézier curve, the parameter of the composite curve increases by one. When calculating the radius vector of a point of the composite curve, first, by the value of the curve parameter t, the number of the working segment (the number of the third-degree Bézier curve) is determined as the largest integer not exceeding t. Let the number of the third-degree Bézier curve be n. Then the fractional part of the parameter w = t - n is determined. The radius vector of the composite curve is calculated as the radius vector of the found segment for its local parameter w.

In the PointOn( double & t, MbCartPoint3D & r ) method, the radius vector of the curve r is described by the vector function of the found segment for its local parameter w:

\[r(t) = \sum\limits_{j = 0}^{3} \frac{3!}{j!(3 - j)!} \cdot w^{j} (1 - w)^{3 - j} \cdot \mathbf{pointList}[3n + j],\]

where w = t - n, n ≤ t ≤ n + 1, 0 ≤ w ≤ 1,

\[B_{j}^{3}(w) = \frac{3!}{j!(3 - j)!} \cdot w^{j} (1 - w)^{3 - j}\]

are the third-degree Bernstein functions for the j-th control point, j = 0, 1, 2, 3, of pointList[3n + j] of the found segment with number n.

The composite Bézier curve is shown in the figure:

../../../../_images/O.4.8.1.png

The curve parameter t takes values on the interval 0 ≤ t ≤ splinesCount. The curve can be periodic. The period of a periodic curve is equal to splinesCount.

For integer values of the parameter, the curve passes through control points; for example, at parameter t = n the curve passes through the control point pointList[3n], n = 0, 1, …, splinesCount. The derivatives of the curve at the junction points of the third-degree Bézier curves (for integer values of the parameter) lose continuity in length.