Smooths the bezier curves that pass through this segment by taking into account the segment’s position and distance to the neighboring segments and changing the direction and length of the segment’s handles accordingly without moving the segment itself.
Two different smoothing methods are available:
-
'catmull-rom'
uses the Catmull-Rom spline to smooth the segment.
The optionally passed factor controls the knot parametrization of the algorithm:
0.0
: the standard, uniform Catmull-Rom spline
0.5
: the centripetal Catmull-Rom spline, guaranteeing no self-intersections
1.0
: the chordal Catmull-Rom spline
-
'geometric'
use a simple heuristic and empiric geometric method to smooth the segment’s handles. The handles were weighted, meaning that big differences in distances between the segments will lead to probably undesired results.
The optionally passed factor defines the tension parameter (0…1
), controlling the amount of smoothing as a factor by which to scale each handle.
Options:
- options.type: String — the type of smoothing method: ‘catmull-rom’, ‘geometric’ — default: ‘catmull-rom’
- options.factor: Number — the factor parameterizing the smoothing method — default:
0.5
for 'catmull-rom'
, 0.4
for 'geometric'
Parameters:
-
options:
Object
— the smoothing options
— optional