Parametric Curves

Parametric Curves is a plugin for Gimp. It takes as input a parametric curve and draws an approximate Bézier curve. (Mathematically, a parametric curve is of the form f(t)=(x(t),y(t)) in Cartesian coordinates, where t is the parameter.)

The central aim of the plugin is to achieve a reasonably good approximation by resorting to only a small number of control points. This is contrary to the naive idea of just inserting control points more densely on the curve in order to reach the desired accuracy.

To install the plugins, start by downloading the zip file. Unzip it. It contains three items, two files and one folder:

When you put the file parametric_curves.py in your plug-ins folder and restart Gimp, the plugin should appear in Gimp's menu as

    Image > Filters > Render > Parametric Curves > Parametric curves

The file doc.pdf is the documentation of the plugin, or more precisely, instructions in its usage. The reader may do wisest going directly to reading it and skipping this page.

Everything that is said about the plugin Simple parametric curve in Simple Parametric Curves holds true for the present plugin too. So, if you have not read it, please do it now; the basic facts are not repeated here. Rather, we concentrate on some points where this plugin differs from the simple one.

Differences from the simple plugin

When the plugin is launched by typing the inputs in the GUI (that is, the inputs are not taken from a file), the only differences from the simple plugin is two new options: Fit in the window and Mark the axes as guides. There is no reason to explain those, but note that if the field Fit in the window is set to Yes, the plugin ignores the values in the next three slots: x and y coordinates of the origo  and scale.

The first big difference from the simple plugin is in the inner workings of the plugin. The simple plugin makes no effort to find any special points on the input curve, such as for example cusp points, which fact causes occasionally very unsatisfactory results. In such cases the simple plugin needs help from the user: one has to input a list of custom values for the parameter t, which results in forced anchor points on the Bezier curve.

The present plugin Parametric Curves, on the contrary, does its best to find such special points and other important points and to take them into account by adding anchors at those points in its own accord, requiring no extra help from the user. Consequently, it works better than the simple plugin. (But it must be admitted that if it is crucial to get, say, cusps exactly right, the user had better to input them as custom values for t; what the plugin finds may not be so exact.)

Another big difference is that the simple plugin allows to draw only one parametric curve at a time. The plugin Parametric Curves, instead, is designed to enable drawing several curves simultaneously (though only with common settings). This feature is available when inputs are read from a file. The term used is a collage of parametric curves. Taking advantage of this feature requires writing in the input file some very specific lines of Python code that may seem rather incomprehensible for somebody not so skilled in Python.

And that can be seen as a third big difference from the simple plugin: the format of the input file is quite different and perhaps looks first a little intimidating. But everything is explained in the documentation doc.pdf. An input file must be valid Python code, and it must contain very specific parts. The user can write such a file from scratch. But an easier way to start is to pick any of the example files and edit it suitably for ones needs. Alternatively, the folder example_files contains in its subfolder templates three template files that are hopefully helpful.

One further difference is worth mentioning: When the inputs are taken from a file which does not contain definitions for all the allowed entries, in the simple plugin the user can choose whether the values of the missing entries are taken from the GUI or default values are used. In the current plugin, default values are always used.

Yet a difference is that the plugin Simple parametric curve has the companion Simple polar curve but nothing similar is offered here. That is no real drawback: any curve in polar form r=r(t) can be put in the parametric form

   f(t) = (r(t)cos(t), r(t)sin(t))

in Cartesian coordinates.

Example files

The example files try to demonstrate various aspects of the plugin and of the entries in an input file. Those files are valid as input files. They can  be edited at will, which gives opportunity to experiments. You can simply run the example files one by one in Gimp just to see what they do (some curves are beautiful!), but you may find it good also to look at the files themselves; the code may contain explanatory comments.

If you apply those example files without editing, you most probably will be surprised to see in some of the pictures small stars appearing along the curves. This is one of the properties offered by the plugin: The small stars are points on the exact target curve. Their purpose is to let the user to check visually, how much the approximate Bézier curve deviates from the exact target curve.

Another, possibly confusing fact in some of the example files is that the anchors and handles of the Bézier curve seem to appear in the drawn picture. They are not the real anchors and handles of the actual Gimp's vectors object, but they are quite identically located. They form a separate vectors object created by the plugin. The purpose is to enable the user to see at one glance, precisely where the plugin decided to put the control points. That fact is no doubt of interest.

Whether the exact points or anchors and handles are drawn or are not drawn, is controlled by the settings in the input file. Default is naturally that nothing such is drawn.

To understand such matters more in detail, please read the file doc.pdf. There you will also learn something of how the plugin works internally, and how you can modify the way it works.

Downloads

Click to download the plugin Parametric Curves as a .ZIP file