~ubuntu-branches/debian/sid/pyx/sid

« back to all changes in this revision

Viewing changes to manual/deformer.rst

  • Committer: Package Import Robot
  • Author(s): Stuart Prescott
  • Date: 2012-12-17 13:45:12 UTC
  • mfrom: (1.1.4)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: package-import@ubuntu.com-20121217134512-u0w6lrgdowsc1sfu
Tags: 0.12.1-1
* New upstream release
* Update maintainer address.
* Update copyright format URL.
* Bump standards version to 3.9.4 (no changes required).
* Drop postinst that was needed for lenny->squeeze upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 
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.
13
12
 
14
13
All classes of the :mod:`deformer` module provide the following methods:
15
14
 
43
42
 
44
43
   *curvesperhloop*: the number of Bezier curves to approximate a half-loop
45
44
 
46
 
   *sign*: with ``sign>=0`` starts the cycloid to the left of the path, ``sign<0``
47
 
   to the right.
 
45
   *sign*: for ``sign>=0`` the cycloid starts to the left of the path, whereas
 
46
   for ``sign<0`` it starts to the right.
48
47
 
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
 
50
   obtains a circle.
51
51
 
52
52
 
53
53
.. class:: smoothed(radius, softness=1, obeycurv=0, relskipthres=0.01)
54
54
 
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.
64
64
 
98
98
     points with infinte curvature. The resulting path stops at such points and
99
99
     leaves the too strongly curved piece out.
100
100
 
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
 
105
     "earlier" one.
105
106
 
106
107
   The parameters are the following:
107
108
 
108
109
   *distance* is the minimal (signed) distance between the original and the
109
110
   parallel paths.
110
111
 
111
 
   *relerr* is the allowed error in the distance is given by ``distance*relerr``.
 
112
   *relerr* is the allowed relative error in the distance.
112
113
 
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
115
 
   corners.
 
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.
116
117
 
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.
120
121
 
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.
123
124
 
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.