Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making G2-continuous paths
#9
Now the plugin has a new version. I removed some functionalities. Instead, I implemented what Ofnuts suggested, the option to preserve non-zero handles (post #4, though perhaps what I made is not quite what he had in mind).

I talk now about that feature only.

Suppose you have a path where there is a corner that should not be smoothed, rather its shape should be preserved. Here is a picture:

   

On the left is the input path. All handles are zero except that the upmost corner has two non-zero handles which determine the shape of the corner. Call the plugin with proper inputs, and it smooths the path elsewhere but preserves those two handles, on the right.

This feature is governed by two inputs in the GUI. The first is a boolean switch; default is 'No', and the feature becomes activated if you click it to 'Yes'. The second input asks for a threshold for "long" handles. Namely, the feature affects only handles which are longer than the threshold. Default is 5.0 pixels.

   

That threshold serves also as a safety guard. It happens very easily (to me at least) when creating a path that where I think a handle is zero it actually is not quite zero. The threshold ensures that such very short handles are ignored by the plugin.

The next picture shows a case where there is some anchor where one handle is "long" (longer than the threshold) and the other is of zero length. On the right is the result: that "long" handle is preserved and everything else is smoothed.

   

The following picture shows a case where there is one segment with a "long" handle at each end. Those handles are preserved, hence the whole segment is preserved:

   

The plugin makes no wonders. Manual corrections may be necessary afterwards. The following rules hold:
  1. If an anchor has two "long" handles they are preserved. The shape of the corner is preserved in the immediate vicinity of the anchor but the adjacent segments are usually slightly deformed since one handle is not enough to define the shape of a segment.
  2. If an anchor has only one "long" handle it is preserved and the other handle is made such that the path is smooth there (this is G1-continuity only).
  3. If an anchor has no "long" handles the path will be made G2-continuous there (that means that the path is smooth and even has continuous curvature there).
Note: If you want to preserve a corner you have to put there two "long" handles (that is, handles exceeding the threshold). If only one of the two handles is "long" the path will be smoothed there; see the pictures.

As before, you can use a selection to restrict the effect. And you can experiment with the two tuning parameters.

The new version is 0.8 at the old place:

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

Scroll to the bottom, and click the right download button ("G2-continuity"). You get a zip file. Unzip it and place the one file it contains (G2_continuity.py) in your user's plug-ins folder. Then (re)start Gimp. To use the plugin: in the Paths tab, right-click a path and follow the links Tools > Modify path > G2-continuity.

Please report any erronous workings. It is getting rather complicated and I am not at all confident that it works all right in all cases. But we can hope for the best.
Reply


Messages In This Thread
Making G2-continuous paths - by Ottia Tuota - 03-18-2022, 05:24 PM
RE: Making G2-continuous paths - by Ofnuts - 03-18-2022, 06:20 PM
RE: Making G2-continuous paths - by Ottia Tuota - 03-18-2022, 06:42 PM
RE: Making G2-continuous paths - by Ofnuts - 03-18-2022, 08:54 PM
RE: Making G2-continuous paths - by Ottia Tuota - 03-19-2022, 04:17 AM
RE: Making G2-continuous paths - by rich2005 - 03-19-2022, 12:23 PM
RE: Making G2-continuous paths - by denzjos - 03-21-2022, 07:45 PM
RE: Making G2-continuous paths - by Ottia Tuota - 03-22-2022, 10:01 AM
RE: Making G2-continuous paths - by Ottia Tuota - 04-02-2022, 06:58 AM

Forum Jump: