Sketcher BSplinePoleWeight

Description
Shows or hides the display of the weights for the control points of a B-spline curve (see below for an explanation of weights).



Usage

 * 1) Select a B-spline and apply.

Explanation
B-splines are basically a combination of Bézier curves (nicely explained in this and this video).

The Bézier curve is calculated using this formula:

$$\quad \textrm{Bezier}(n,t)=\sum_{i=0}^{n}\underbrace{\binom{n}{i}}_{\text{polynomial term}}\underbrace{\left(1-t\right)^{n-i}t^{i}}_{\text{polynomial term}}\; \underbrace{P_{i}}_{\text{point coordinate}} $$

n is hereby the degree of the curve. So a Bézier curve of degree n is a polygon with order n. The factors $$P_{i}$$ are hereby in fact the coordinates of the Bézier curves' control points. For a visualization see this page.

The term weight in FreeCAD is a bit misleading because in literature the factors $$P_{i}$$ are often called weights as well. FreeCAD's weights are something different. The idea of these weights is to modify the spline so that the different control points are "weighted". The idea is that a point with weight 2 should have twice as much influence than a point with weight 1. This is achieved by using this different formula to calculate the spline:

$$\quad \textrm{Rational Bezier}(n,t)=\cfrac{\sum_{i=0}^{n}\binom{n}{i}\left(1-t\right)^{n-i}t^{i}w_{i}P_{i}}{\sum_{i=0}^{n}\binom{n}{i}\left(1-t\right)^{n-i}t^{i}w_{i}\;\;\;\,} $$

whereby $$w_{i}$$ is the weight for the point $$P_{i}$$.

This is a new class of Bézier curves because despite the points are indeed weighted as desired, the curve is no longer a polynomial but a fractional polynomial. Therefore these curves are called rational Bézier curves and the B-splines is then called rational B-splines.

The consequence is that you gain more flexibility in defining the spline shape. If all weights are equal, the shape of the spline does not change. So the weights relative to each other is important, not the value alone. For example this spline has exactly the same shape as the one in the first image:



A weight of zero would be a singularity in the equation to calculate the rational Bézier curves, therefore FreeCAD assures that it cannot become zero. Nevertheless, small values have the same effect as if the control point would almost not exist:



Creation
Rational B-splines are created by setting a radius for the circles of the control points. That a radius has a unit must hereby ignored, the weight is always the radius in mm (or in the base length unit you set in the preferences). So a radius of 1 µm means a weight of 0.001. By default, meaning on creation time, all circles have the constraint to be equal. For the radius of the circle of the first point FreeCAD automatically sets a size constraint. Since all circles have the same radius, the set value is not important. So after creation you have a non-rational ("normal") B-spline.

To set a weight, remove the equality constraint for the circle of the desired point. You can now drag the circle to see the effect on changing its radius. But note: to set the weight fix so that further actions won't change it, you must set a size constraint.