The deformer module provides techniques to generate modulated paths. All classes in the deformer module can be used as attributes when drawing/stroking paths onto a canvas, but also independently for manipulating previously created paths. The difference to the classes in the deco module is that here, a totally new path is constructed.
All classes of the deformer module provide the following methods:
| (specific parameters for the class)) |
| path) |
The deformer classes are the following:
| radius, halfloops=10, skipfirst=1*unit.t_cm, skiplast=1*unit.t_cm, curvesperhloop=3, sign=1, turnangle=45) |
radius: the radius of the cycloid (this is the radius of the 3D spring)
halfloops: the number of half-loops of the cycloid
skipfirst and skiplast: the lengths on the original path not to be bent to a cycloid
curvesperhloop: the number of Bezier curves to approximate a half-loop
sign: with sign>=0 starts the cycloid to the left of the path, sign<0 to the right.
turnangle: the angle of perspective on the 3D spring. At
turnangle=0 one sees a sinusoidal curve, at turnangle=90 one
essentially sees a circle.
| radius, softness=1, obeycurv=0, relskipthres=0.01) |
The new curve smoothing the corner consists either of one or of two Bezier
curves, depending on the surrounding path elements. If there are straight lines
before and after the new curve, then two Bezier curves are used. This optimises
the bending of curves in rectangular boxes or polygons. Here, the curves have
an additional degree of freedom that can be set with softness
.
If one of the concerned path elements is curved, only one Bezier curve is used
that is (not always uniquely) determined by its geometrical constraints. There
are, nevertheless, some caveats:
A curve that strictly obeys the sign and magnitude of the curvature might not look very smooth in some cases. Especially when connecting a curved with a straight piece, the smoothed path contains unwanted overshootings. To prevent this, the parameter default obeycurv=0 releases the curvature constraints a little: The curvature may then change its sign (still looks smooth for human eyes) or, in more extreme cases, even its magnitude (does not look so smooth). If you really need a geometrically smooth path on the basis of Bezier curves, then set obeycurv=1.
| distance, relerr=0.05, sharpoutercorners=0, dointersection=1, checkdistanceparams=[0.5], lookforcurvatures=11) |
There are some caveats:
The parameters are the following:
distance is the minimal (signed) distance between the original and the parallel paths.
relerr is the allowed error in the distance is given by
distance*relerr.
sharpoutercorners connects the parallel pathitems by wegde build of straight lines, instead of taking circular arcs. This preserves the angle of the original corners.
dointersection is a boolean for performing the last step, the intersection step, in the path construction. Setting this to 0 gives the full parallel path, which can be favourable for self-intersecting paths.
checkdistanceparams is a list of parameter values in the interval (0,1) where the distance is checked on each parallel pathitem
lookforcurvatures is the number of points per normpathitem where its curvature is checked for critical values