Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Replicating a path
#11
Thank you for the script Ottia Tuota Smile 
My first try:

   
Reply
#12
Thanks to all who tried the plugin.

Here is a new plugin, "Replicate path by affine mapping". The idea is that when you take a path and apply the tools Move, Scalse, Rotate, Shear, Flip to it, then the plugin enables you to do the same action repeatedly in one step, producing a succession of paths. Some quickly made miscellanous examples of what the plugin does:

   

The plugin is here:

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

Unzip the .zip file and place the one file it contains (replicate_path_by_affine_mapping.py) in your user's plug-ins folder. Then (re)start Gimp. The plugin is in the menu here:

Tools > Replicate > Replicate path by an affine mapping.

I explain the plugin now. But do not expect too much of it. It is rather limited and often what it produces is not what you were trying to get.

The plugin is used as follows. As input you give two paths; I call them "the Original path" and "the Seed".
  1. The Original path is any path you have made.
  2. The Seed you construct: (1) Take a copy of the Original path. (2) To the copy apply any of the tools Move, Scale, Rotate, Shear, Flip, either one of them or several in succession. (This means that you are applying some affine transformation.)
  3. Then you call the plugin: right-click the Original path and navigate to the plugin, and in the GUI choose the Seed path.
Example

   

  1. The Original path is created.
  2. The Seed is created from a copy, in this picture with tools Move, Rotate, Scale.
  3. The plugin is called with the proper paths.
The plugin works by examining the two input paths, recognizing the applied transformation to its best ability, and then applying the transformation repeatedly, producing a succession of new paths. Or, to borrow notation from mathematics, let

P = the Original path
F = the affine transformation (the tools Move,...).

Then Seed = F(P), and what the plugin creates are paths F(F(P)), F(F(F(P))), F(F(F(F(P)))), ...

As default the plugin merges all output paths together but it allows you to have them as separate paths.

A word of caution: It may happen that the transformation F cannot be determined uniquely from the Original path and the Seed. Then the plugin just chooses one from a small number of possibilities, and it may not be what you wanted. The remedy is to put an additional anchor somewhere in the Original path to help the plugin to make the right decision. (And the Seed must be constructed after adding the anchor.)

Finally, some playings, together with Path to selection and Bucket fill or Gradient. Sorry if these hurt your eyes, I don't have the same skills as some others.


   
Reply
#13
@Ottia Tuota, nice work to build new tools for using in gimp. Is it possible that there is a bug in the program ? The first item in the menu (The path to be replicated) is just visible after using the plugin one time.
   
First activation plugin :
   
Reply
#14
Thank you for the great new script Ottia Tuota. It'll take me  practice to use effectively but here's an initial try:

   
Reply
#15
(12-21-2021, 05:33 PM)denzjos Wrote: @Ottia Tuota, nice work to build new tools for using in gimp. Is it possible that there is a bug in the program ? The first item in the menu (The path to be replicated) is just visible after using the plugin one time.

First activation plugin :

I experienced something like the one reported by Denzjos. Only after several attempts the first menu item never appeared.

Edited:

Several attempts and so far the first menu has not been displayed.

However the plugin seems to find the "Seed" anyway.
   

Edited 02:

Ohh...
Now I see that there is really no need for this menu, as the "Seed" is actually indicated by the second menu.

It seems that the version made available is already an improvement on the one shown in the plugin presentation in this topic.

Thx!
                               .....
Samj PortableGimp 2.10.28 - Win-10 /64.
Reply
#16
(12-21-2021, 05:33 PM)denzjos Wrote: @Ottia Tuota, nice work to build new tools for using in gimp. Is it possible that there is a bug in the program ? The first item in the menu (The path to be replicated) is just visible after using the plugin one time.

It is my experience that that is how Gimp works.

When you call the plugin the first time by right-clicking the path in the Paths dock, then the path does not appear in the GUI. Gimp sets it automatically to be the path the plugin is working on.

If you then re-call the plugin by pressing ctrl-shift-F, the path does appear in the GUI. You can then change the path if you like.

But: If instead of ctrl-shift-F you do again the right-clicking thing, the path is not shown in the GUI. I guess Gimp thinks that you know what path you want and there is no need to change it.

This may be confusing when the plugin needs two paths as input.

But I think this is the normal way how Gimp works. Perhaps somebody more knowledgable can confirm or refute.

Perhaps the wording in the GUI is not very good. Instead of "Path to be replicated" and "Seed" it would better to call them "Primary input path" and "Secondary input path". I must think about it. Any suggestions?
Reply
#17
@Ottia Tuota, thanks for the explanation. For me, the wording in the GUI is understandable, so that's fine for me.
Reply
#18
Thanks denzjos. But I decided to change the wording a little: I call the Seed now the Auxiliary path. Perhaps it is clearer that way. The new version 0.2 is here:

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

No other changes.
Reply
#19
Ahhh...just made some suggestions Wink

   

However, that using the unified transform tool, very easy to move, rotate, scale all in one
It is picky about position and I could generate errors when the input and seed had a large separation.
Very nice plugin.
Reply
#20
(12-22-2021, 10:15 AM)rich2005 Wrote: However, that using the unified transform tool, very easy to move, rotate, scale all in one
It is picky about position and I could generate errors when the input and seed had a large separation.

Yes, indeed, I had not noticed the Unified Transform tool.

What errors did you get? If it was

"No affine transformation was found.
Perhaps you chose the wrong transformed path
or used in its construction some other tool than
Move, Scale, Rotate, Share, or Flip?
"

then it came from the plugin. The plugin works by examining the two paths and it tries to find out if one is obtained by an affine transformation from the other. Crucial is line 424:

    ACCEPT_ERROR = 1e-3

and that error limit 1e-3 = 0.001 could be too small, I don't know. It is in pixels.

But I tried now the Unified Transform tool and I think that perhaps the question was that you made in the tool some non-affine transformation (that is, Perspective). It happens if you crab the small diamond in some corner. When you use the tool, pay attention to the 3x3-matrix in the top right corner and there look at the bottom row. The bottom row should remain as

    0.0000    0.0000    1.0000

and if it changes then the transformation is no longer affine.

There is a very good reason why the plugin accepts only affine transformations: it was easy to make. And most importantly the repeated transformations are easy to do, one needs only to map the control points, without creating any approximate Bezier curves. But I think I know how to make rather easily a similar plugin that accepts Perspective transformations if we restrict it to straight-edge paths. And then, if we want to generalize that further, to accept curved paths, then we need some approximation algorithm and that means harder work. Who knows, perhaps later?
Reply


Forum Jump: