Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 9b3ef98d82282343cfac7f840aa5ab34 > files > 313

PyX-0.11.1-1.fc15.i686.rpm

Smoothing paths

This example shows how to use the `deformer` class. A deformer takes an
original path and return a modified one, which is here a smoothed variant. The
deformer can be used like any other attribute when stroking or filling a path.

Here, we show the use of `deformer.smoothed`, which smoothes away corners in
the original path. ... It operates on the `pathitem`s of the original path and
cuts out pieces of a given length (`1.0` in the example) surrounding a corner
and replaces them by a smooth curve. This new curve is determined to be
''geometrically smooth'', exhibiting the same tangents and curvatures as the
original path at the connection points. Alltogether, the smoothing is performed
not in a strictly ''geometrical'' sense but also depends on the
parameterization of the path. If you try to smooth a path consisting of many
short path elements, nothing will really change.

! In all deformers, the deformed path can be accessed directly by

    ps = deformer.smoothed(1.0).deform(p)