Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Replicating a path
#1
Here is an experimental plugin. It is still at a preliminary stage and produces sometimes bad results. But I decided to publish it now since I think it may be useful as it is. And I am interested to hear any suggestions.

The plugin takes a path and replicates it along a circle:

   

So far the plugin works well for straight-edge paths (with some limitations) but you can try it with curved paths too.

With the plugin you can easily make the circular figures (but now as paths) in the following old thread:

https://www.gimp-forum.net/Thread-How-to...le-meander?

You can download the plugin from

http://kmarkku.arkku.net/Path_replicate_...aster.html

Unzip the .zip file and place the one file it contains (replicate_path_along_circle.py) in your user's plug-ins folder. Then (re)start Gimp. Make a new image, and there a Pattern path like above. In Gimp's menu, go to the Paths dock, right-click the pattern path, and follow the links

Tools > Replicate > Replicate path along circle

and click. That opens the GUI of the plugin. I explain now the inputs.

Paths

In addition to the "Pattern path" (the path to be replicated) the plugin asks for a "Base path". It is a path with a single stroke. The stroke must be open so that it has two ends. Those end points are used as reference points: they are mapped precisely onto the circle. Example:

   

The Pattern is the blue arrow. Below it the red 2-anchor line is the "Base". You can imagine that the Base and the Pattern are transformed together: the end points of the Base are mapped onto the circle and the Pattern follows along. The result, using default values, is on the right. (The transformed Base is not shown here but the plugin does allow it to be drawn too. The same goes for the circle.)

Replication

To control the replication process there is a list of parameters:
  • Circle center x
  • Circle center y
  • Circle radius
  • Sector start
  • Sector angle
  • Number of copies
  • Radial scaling
The first three determine the circle and the next two its sector. In the above pictures only the whole circle was used, but you can also restrict the replication to the sector. For instance, with Sector start = 0 and Sector angle = 90 you can get:

   

The meaning of "Number of copies" and "Radial scaling" should be obvious. The latter does not change the circle but it scales the transformed pattern radially.

Distortion method

The plugin distorts the pattern to accommodate to the circular arc. There are three choices for how the distortion is done. The most natural is the default "polar coordinates" and probably that is all you will need. You can try the "exponential" method. It has the advantage to be conformal when radial scaling is 1, and that property may be useful sometimes (and for a mathematician this is the most natural choice!). The third choice is "no distortion" which causes the pattern to be copied as such (if radial scaling is 1).

If you use distortion you are safest when you apply the plugin only to straight-edge paths. Curved paths may cause unpleasant surprises; see below. If you choose "no distortion", however, curved paths should cause no problems.

Other drawings

With the last two inputs
  • Apply to the base path too?
  • Draw the circle?
you can make the plugin (1) to transform and draw the Base path too; (2) to draw the target circle.

Above I talked about the Base path as if it were only a 2-anchor path and nothing else. But all that is required of it is that it has a single stroke and that the stroke has two ends. Those end points are used as reference points. But between the end points the stroke may be anything, and sometimes you can use it as a part of the drawing; for that reason there is the option to draw the transformed Base. Or maybe you just want to see where the reference points are mapped to.

Known limitations

The current plugin may give bad results in distortions at least if:
  • The path has strongly bending or very long arcs, or inflection points. The remedy is to add anchors at strategic points.
  • The path is much wider than the base. Sometimes this is disastrous but not always - see the last picture below.
  • The ratio (Sector angle)/(Number of copies) is large. The plugin allows 120 degrees at most, and occasionally even that is a little too much.
I hope to make improvements in some later version.

Joining strokes

Look at the first picture. The resulting path consists of 12 sectors, and each sector is made of 4 short strokes, three open and one closed. But clearly the open short strokes could be joined to longer strokes, going round the whole figure. The plugin does not do this. But if you want to do the joinings, my plugin in

https://www.gimp-forum.net/Thread-Joinin...-of-a-path

seems to work well with its default values. And so does Ofnuts' plugin Edit > Join strokes contained in ofn-path-edits. In the first picture I created the pattern path by means of a grid and "snap to grid". That way the strokes were easily joined in the result.

Finally, a little playing. The Base is the red line in the middle, precisely half of the width of the grid:

   
Reply


Messages In This Thread
Replicating a path - by Ottia Tuota - 12-05-2021, 09:32 AM
RE: Replicating a path - by rich2005 - 12-05-2021, 11:35 AM
RE: Replicating a path - by Ottia Tuota - 12-05-2021, 11:55 AM
RE: Replicating a path - by rich2005 - 12-05-2021, 12:26 PM
RE: Replicating a path - by Ottia Tuota - 12-06-2021, 08:08 AM
RE: Replicating a path - by Ottia Tuota - 12-11-2021, 12:06 PM
RE: Replicating a path - by Krikor - 12-11-2021, 03:22 PM
RE: Replicating a path - by denzjos - 12-12-2021, 07:17 PM
RE: Replicating a path - by Ottia Tuota - 12-12-2021, 08:02 PM
RE: Replicating a path - by nelo - 12-13-2021, 09:38 AM
RE: Replicating a path - by teapot - 12-21-2021, 03:44 AM
RE: Replicating a path - by Ottia Tuota - 12-21-2021, 01:24 PM
RE: Replicating a path - by denzjos - 12-21-2021, 05:33 PM
RE: Replicating a path - by Ottia Tuota - 12-21-2021, 07:37 PM
RE: Replicating a path - by teapot - 12-21-2021, 06:27 PM
RE: Replicating a path - by Krikor - 12-21-2021, 07:05 PM
RE: Replicating a path - by denzjos - 12-22-2021, 09:05 AM
RE: Replicating a path - by Ottia Tuota - 12-22-2021, 10:09 AM
RE: Replicating a path - by rich2005 - 12-22-2021, 10:15 AM
RE: Replicating a path - by Ottia Tuota - 12-22-2021, 11:44 AM
RE: Replicating a path - by rich2005 - 12-22-2021, 02:14 PM
RE: Replicating a path - by Ottia Tuota - 12-22-2021, 04:40 PM
RE: Replicating a path - by denzjos - 12-23-2021, 09:54 AM
RE: Replicating a path - by Ottia Tuota - 12-23-2021, 12:41 PM
RE: Replicating a path - by Ottia Tuota - 01-28-2022, 04:49 PM
RE: Replicating a path - by Ottia Tuota - 01-29-2022, 07:56 AM
RE: Replicating a path - by rich2005 - 01-29-2022, 04:07 PM
RE: Replicating a path - by Ottia Tuota - 01-29-2022, 04:32 PM
RE: Replicating a path - by rich2005 - 01-29-2022, 04:38 PM
RE: Replicating a path - by teapot - 01-30-2022, 03:18 AM
RE: Replicating a path - by Ottia Tuota - 01-30-2022, 07:02 AM
RE: Replicating a path - by Ottia Tuota - 01-30-2022, 08:57 AM
RE: Replicating a path - by denzjos - 01-30-2022, 04:27 PM
RE: Replicating a path - by Ottia Tuota - 01-30-2022, 04:43 PM
RE: Replicating a path - by denzjos - 01-30-2022, 05:34 PM
RE: Replicating a path - by Ottia Tuota - 01-30-2022, 06:18 PM
RE: Replicating a path - by teapot - 02-01-2022, 03:45 AM
RE: Replicating a path - by Ottia Tuota - 02-01-2022, 06:42 AM
RE: Replicating a path - by Ottia Tuota - 02-02-2022, 12:02 PM
RE: Replicating a path - by teapot - 02-03-2022, 04:18 AM
RE: Replicating a path - by Ottia Tuota - 02-03-2022, 04:52 AM
RE: Replicating a path - by teapot - 04-28-2022, 12:20 AM
RE: Replicating a path - by Ottia Tuota - 04-28-2022, 05:30 AM
RE: Replicating a path - by Ottia Tuota - 04-28-2022, 11:15 AM
RE: Replicating a path - by rich2005 - 04-28-2022, 12:18 PM
RE: Replicating a path - by Ottia Tuota - 04-28-2022, 01:58 PM
RE: Replicating a path - by Krikor - 04-28-2022, 03:49 PM
RE: Replicating a path - by rich2005 - 04-28-2022, 03:16 PM
RE: Replicating a path - by teapot - 04-28-2022, 03:58 PM
RE: Replicating a path - by Ottia Tuota - 04-28-2022, 04:17 PM
RE: Replicating a path - by Krikor - 04-28-2022, 04:46 PM
RE: Replicating a path - by teapot - 04-29-2022, 01:36 AM
RE: Replicating a path - by Ottia Tuota - 04-29-2022, 04:28 AM
RE: Replicating a path - by Krikor - 04-29-2022, 01:22 PM
RE: Replicating a path - by teapot - 04-30-2022, 03:05 AM
RE: Replicating a path - by rich2005 - 08-05-2022, 11:00 AM
RE: Replicating a path - by teapot - 08-07-2022, 01:40 AM
RE: Replicating a path - by Zero01 - 04-30-2023, 04:49 PM
RE: Replicating a path - by Krikor - 04-30-2023, 09:20 PM
RE: Replicating a path - by Zero01 - 05-02-2023, 06:32 PM

Forum Jump: