8
8
The :mod:`deformer` module provides techniques to generate modulated paths. All
9
9
classes in the :mod:`deformer` module can be used as attributes when
10
drawing/stroking paths onto a canvas, but also independently for manipulating
11
previously created paths. The difference to the classes in the :mod:`deco`
12
module is that here, a totally new path is constructed.
10
drawing/stroking paths onto a canvas. Alternatively new paths can be created by
11
deforming an existing path by means of the :meth:`deform` method.
14
13
All classes of the :mod:`deformer` module provide the following methods:
44
43
*curvesperhloop*: the number of Bezier curves to approximate a half-loop
46
*sign*: with ``sign>=0`` starts the cycloid to the left of the path, ``sign<0``
45
*sign*: for ``sign>=0`` the cycloid starts to the left of the path, whereas
46
for ``sign<0`` it starts to the right.
49
*turnangle*: the angle of perspective on the 3D spring. At ``turnangle=0`` one
50
sees a sinusoidal curve, at ``turnangle=90`` one essentially sees a circle.
48
*turnangle*: the angle of perspective on the 3D spring. At ``turnangle=0``
49
results in a sinusoidal curve, whereas for ``turnangle=90`` one essentially
53
53
.. class:: smoothed(radius, softness=1, obeycurv=0, relskipthres=0.01)
55
55
This deformer creates a smoothed variant of the original path. The smoothing is
56
done on the basis of the corners of the original path, not on a global skope!
56
done on the basis of the corners of the original path, not on a global scope!
57
57
Therefore, the result might not be what one would draw by hand. At each corner
58
(or wherever two path elements meet) a piece of length :math:`2\times` *radius*
58
(or wherever two path elements meet) a piece of twice the *radius*
59
59
is taken out of the original path and replaced by a curve. This curve is
60
60
determined by the tangent directions and the curvatures at its endpoints. Both
61
are given from the original path, and therefore, the new curve fits into the gap
61
are taken from the original path, and therefore, the new curve fits into the gap
62
62
in a *geometrically smooth* way. Path elements that are shorter than
63
63
*radius* :math:`\times` *relskipthres* are ignored.
98
98
points with infinte curvature. The resulting path stops at such points and
99
99
leaves the too strongly curved piece out.
101
* When the original path contains self-intersection, then the resulting parallel
102
path is not continuous in the parameterisation of the original path. It may
103
first take a piece that corresponds to "later" parameter values and then
104
continue with an "earlier" one. Please don't get confused.
101
* When the original path contains on or more self-intersections, then the
102
resulting parallel path is not continuous in the parameterisation of the
103
original path. This may result in the surprising behaviour that a piece
104
that corresponding to a "later" parameter value is followed by an
106
107
The parameters are the following:
108
109
*distance* is the minimal (signed) distance between the original and the
111
*relerr* is the allowed error in the distance is given by ``distance*relerr``.
112
*relerr* is the allowed relative error in the distance.
113
*sharpoutercorners* connects the parallel pathitems by wegde build of straight
114
lines, instead of taking circular arcs. This preserves the angle of the original
114
*sharpoutercorners* connects the parallel pathitems by a wegde made of
115
straight lines, instead of taking circular arcs. This preserves the angle of
116
the original corners.
117
118
*dointersection* is a boolean for performing the last step, the intersection
118
119
step, in the path construction. Setting this to 0 gives the full parallel path,
119
120
which can be favourable for self-intersecting paths.
121
122
*checkdistanceparams* is a list of parameter values in the interval (0,1) where
122
the distance is checked on each parallel pathitem
123
the distance is checked on each parallel pathitem.
124
125
*lookforcurvatures* is the number of points per normpathitem where its curvature
125
is checked for critical values
126
is checked for critical values.