# Path transformations

Here you find some Gimp plugins to transform paths. To get the plugins, do:
1. At the bottom of this page there is the Download button. Clicking it you get one .ZIP file. Unzip it and put the python file it contains in your Gimp's plug-ins folder and restart Gimp.
2. This registers in your Gimp the plugins
• Transform a path by an affine map
• Transform a path by a Bezier arc
• Transform a path by a Moebius map (actually a plugin and three further variations)
• Transform a path by a Bezier arc quadrilateral (an easy version and an advanced version)
• Fit a path in a triangle
• Fit a path in a convex quadrilateral
• Convert a path to polar coordinates
• Transform a path by exponential map
3. To find the plugins in Gimp, go to the Paths tab and right-click the path you are going to transform. This opens a pop-up window. At the bottom follow the link
Tools > Transformations > ...  and choose from the transformations.
No detailed instructions of usage are given here at the moment. But the plugins should be easy to use just by experimenting, and some explanations and pictures appear at www.gimp-forum.net. To make starting easier, we list here the required input paths with some explanations:
• Transform a path by an affine map requires three input paths:
• The path you are transforming (the right-clicked one).
• Base. A path which should have 1-3 anchors in one stroke.
• Target. A path which should have at least as many anchors as the Base.
Assume first that you want to perform a general affine transformation. Such a map is defined by specifying two triples of points, (A,B,C) and (X,Y,Z), and requiring that A is mapped to X, B to Y, and C to Z. The anchors of the Base will serve as the points A,B,C, and the anchors of the Target as the points X,Y,Z; thus, the Base and the Target define the affine transformation: the map sends the Base to the Target.
If the Base has only two anchors, the map will be a direct similitude, and if it has only one anchor, the map will be a translation.
• Transform a path by a Bezier arc requires four input paths:
• The path you are transforming (the right-clicked one).
• Base. A path with two anchors in one stroke.
• Target. A path with two anchors in one stroke.
• Shaper. A path with two anchors in one stroke.
As in the case of affine maps, the Base and the Target determine from where to where the map goes: the anchors A,B of the Base are mapped onto the anchors X,Y of the Target. The Shaper is a short Bézier arc. It determines what could be called the shape of the transformation. Each straight line segment will be sent onto a Bézier arc whose shape is somehow determined by the Shaper.
What that "somehow" means is not described here. We mention only that if the plugin is applied with default inputs (the tweaks A=0, B=1) to transform the Base itself, its image will be a Bézier arc similar to the Shaper but located at the Target. How other line segments are mapped, is in practice unpredictable to the user and a source of nice surprises. (It is all just too complicated to know the outcome beforehand.)
It should be stressed that the map is conformal (if we exclude degenerate cases and at most two isolated points). If you are curious to see what this plugin is about, the mathematics behind it, in the thread www.gimp-forum.net (post #3) you can find a small .pdf presenting the simple idea.
• Transform a path by a Bezier arc quadrilateral: The advanced version requires four input paths:
• The source path you are transforming (the right-clicked one).
• Shaper. A path with four anchors in one stroke.
• Reference box. A path with four anchors in one stroke. But there are built-in choices, such as the bounding box of the source path.
• Target box. A path with four anchors in one stroke.
The easy version dispenses with the Target, and for the Reference box there are only 4 built-in choices.

This plugin is rather similar to the previous one. But this map is not conformal, the Shaper is a path of four Bézier arcs roughly in the form of a quadrilateral, and the Reference box and the Target box have four anchors each. For more details, see the thread www.gimp-forum.net (posts #18 and #19). In the thread you can also find a .pdf file which contains formulas and some other ideas behind the plugin.
• Transform a path by a Moebius map requires three input paths:
• The path you are transforming (the right-clicked one).
• Base. A path which should have 3 anchors in one stroke.
• Target. A path which should have 3 anchors in one stroke.
This is the Möbius transformation on the extended complex plane (plane plus a point at infinity). Of its properties we mention a few:
• It is conformal.
• It sends circular arcs onto circular arcs.
• But here "circle" includes straight lines (circles with infinite radius). Hence, the map sends a straight line to a circle (or occasionally to another straight line).
• The map has normally one pole, a point which is sent to infinity. If the pole is on the path to be transformed or in its close vicinity, the plugin may fail.
• Another special point is the so-called inverse pole. It is the pole of the inverse map; in other words, it is the point to which the infinite point will be sent.
The regular form of the plugin allows no control on the pole or the inverse pole. Where they will turn out to be, is just a matter of luck, though of course it follows somehow from the choice of the Base and the Target. But included are three other plugins, variations of the Moebius plugin, which do offer such control. No explanations are given here (you can have a peek at www.gimp-forum.net), but note that in those plugins the Base and the Target are supposed to have fewer anchors than three. See the plugins and experiment.
• Fit a path in a triangle takes as input the path to be transformed and another path in the form of a triangle. The first path is fitted in the triangle by means of a mapping called dilation (translation and scaling). The path will not be distorted.
• Fit a path in a quadrangle works similarly, exceptthat instead of a triangle it uses a convex quadrangle, and that the mapping is a projective transformation. Consequently, the path is also distorted. Further, this plugin is not exact but does an approximation. The user has option to choose the level of the approximation (algorithm). In addition, the user can tweak the operation by drawing a reference box (a quadrangle) roughly around the input path. Default uses the bounding box.
• Convert a path to polar coordinates imitates Gimp's filter Distorts>Polar coordinates but this plugin is applied to a path rather than an image. It takes as input one path. It should be easy to experiment with, starting with the default values. A remarkable feature is that straight lines are mapped onto Archimedean spirals, or as special cases onto straight line or circles.
• Transform a path by exponential map is very similar to To polar coordinates but it performs complex exponential map (the plane is viewed as the complex number plane).  It takes as input one path and two angles: alpha and gamma. Instead of Archimedean spirals, straight lines are generally mapped onto logarithmic spirals.