Details and Options
ResourceFunction["CurveToBSplineFunction"] returns a
BSplineFunction object.
Before processing, successive duplicate points are removed from the input list of points {pt_{1},pt_{2},…}.
ResourceFunction["CurveToBSplineFunction"][{pt_{1},pt_{2},…},d] is equivalent to ResourceFunction["CurveToBSplineFunction"][{pt_{1},pt_{2},…},d,1].
The second argument
d determines the maximal degree of the underlying polynomial basis used by a
BSplineFunction object. Increasing this value leads to a smoother spline with fewer details.
The third argument
scale is the scale factor used for filling the gaps between successive points of the curve when the option
"FillGaps"→True is set. With this setting,
equidistant control points will be introduced between the points
pt_{i} and
pt_{i+1}. By default, it is assumed that a scale of 1 means that no intermediate control points will be introduced when the Euclidean distance between successive points is less than 2. Increasing this value leads to a smoother spline with fewer details.
The following options can be given:
"AssignWeights" | False | controls assigning weights to the control point of a generated spline |
"CurveClosed" | False | whether to treat the input curve defined by points {pt_{1},pt_{2},…} as closed |
"DuplicateNodes" | False | controls duplication of the input control points pt_{i} |
"FillGaps" | True | whether to introduce intermediate control points |
The option setting
"AssignWeights"→Automatic assigns to every control point of a generated spline the weight equal to the sum of its distances to the two adjacent points. With the setting
"AssignWeights"→f, where
f is a function, the weight of the point will be set to
f[pt_{i}, {l, r}, angle, scale]. This option helps to preserve the shape of the original curve by selectively increasing the weights of the control points.
With the setting
"CurveClosed"→True, the input list of points
{pt_{1},pt_{2},…} is treated as cyclic.
The option
"DuplicateNodes" gives flexible control over duplication of the input control points
pt_{i} inside of a produced
BSplineFunction. With the setting
"DuplicateNodes"→n, every point will be duplicated
n times. With the setting
"DuplicateNodes"→Automatic, every input point
pt_{i} will be duplicated
Max[Floor[(l+r)/(2 scale)],1] times, where
l and
r are Euclidean distances to the adjacent points from the left and the right, respectively. With
"DuplicateNodes"→f, where
f is a function, the point will be duplicated
f[pt_{i}, {l, r}, angle, scale] times, where
angle is the interior angle at the vertex point
pt_{i} (for the boundary points,
angle is set to
Infinity). This option allows preservation of the sharp corners of the original curve by duplicating the corresponding control points.