Details and Options
ResourceFunction["CurveToBSplineFunction"] returns a
BSplineFunction object.
Before processing, successive duplicate points are removed from the input list of points {pt1,pt2,…}.
ResourceFunction["CurveToBSplineFunction"][{pt1,pt2,…},d] is equivalent to ResourceFunction["CurveToBSplineFunction"][{pt1,pt2,…},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
pti and
pti+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 {pt1,pt2,…} as closed |
"DuplicateNodes" | False | controls duplication of the input control points pti |
"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[pti, {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
{pt1,pt2,…} is treated as cyclic.
The option
"DuplicateNodes" gives flexible control over duplication of the input control points
pti 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
pti 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[pti, {l, r}, angle, scale] times, where
angle is the interior angle at the vertex point
pti (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.