Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Chopping a path
#1
I made two plugins to chop the strokes of a path to smaller pieces. One is old, one is new.

To get the plugins, go to

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

and click the Download button. Unzip. Put the file chop_path.py in the user's plug-ins folder. Restart Gimp. In the Paths tab, right-click the path you want to chop. Follow the links

Tools > Chopping > ...

There you see two plugins:
  • Chop the path at its anchors
  • Chop the path by another path
I explain now both a little.

Chop the path at its anchors

This is the old one but now it is in a different place in Gimp's menu. Also the wording of the GUI and the default action are a little different. The plugin chops the strokes of the path at the anchors, producing 2-anchor strokes. The default differs from what it was before: now the default is to make one path, so that the effect is to chop the strokes of the path into small 2-anchor strokes. Optionally you can make all the 2-anchor strokes into separate paths.

Chop the path by another path

In this plugin we have two paths: the one to be chopped and another path. The action is that the strokes of the path are chopped into shorter strokes by cutting them at the crossing points with the other path. Optionally all the shorter strokes can be made to separate paths each.

Example 1

On the left the red path has 1 stroke with 4 anchors. That path we want to chop. There is another path (blue), and that is the chopping path.

   

In the middle picture the plugin has been applied: The red path is chopped by the blue path. You see there 3 new anchors at the crossing points; those 3 anchors are in fact double anchors and stroke ends. The red stroke has been cut into 4 shorter strokes, so the path consists now of 4 strokes. To show that they are indeed 4 separate strokes, I moved their ends a little apart, on the right.

Example 2

A spiral chopped to pieces. To begin with, the spiral (red) is one stroke. It is chopped by the fan of lines (another path, blue).

   

After chopping, the spiral consists of 48 strokes, on the right. In this picture the spiral is chopped into 2-anchor strokes, and I grabbed and moved 3 of them to show that they indeed are separate strokes.

In this example the new short strokes happen to have only 2 anchors each (the end points). But since the plugin preserves all original anchors, in general you often get strokes with more than 2 anchors. If needed, you can try to get rid of some anchors with the Simplify plugin.

The ordering of the strokes follows the original spiral. The plugin enables you also to make separate paths instead of one path with several strokes.

Example 3

You can also use the plugin to chop a path by itself. On the left we have a red path, one stroke with 3 anchors. In the middle picture the path is chopped by itself. This means that the stroke has been cut at the crossing points. On the right I moved the stroke ends a little so that you can see how the cuts are done. Now there are 5 strokes.

   

For those interested: To do this plugin I had to compute intersections of two Bezier curves. I implemented the "interval subdivision algorithm" in Section 7.6 of:

https://scholarsarchive.byu.edu/cgi/view...ext=facpub

And that was the easy part in the work.

If the plugins do not work as supposed, please report.
Reply


Messages In This Thread
Chopping a path - by Ottia Tuota - 10-07-2021, 07:15 AM
RE: Chopping a path - by denzjos - 10-07-2021, 10:48 AM
RE: Chopping a path - by denzjos - 10-08-2021, 08:15 AM
RE: Chopping a path - by Ottia Tuota - 10-08-2021, 01:46 PM
RE: Chopping a path - by denzjos - 10-09-2021, 10:45 AM
RE: Chopping a path - by Ottia Tuota - 10-09-2021, 01:58 PM
RE: Chopping a path - by Ottia Tuota - 10-10-2021, 02:23 PM
RE: Chopping a path - by denzjos - 10-10-2021, 03:18 PM
RE: Chopping a path - by Ottia Tuota - 10-10-2021, 03:49 PM
RE: Chopping a path - by denzjos - 10-11-2021, 08:08 AM
RE: Chopping a path - by Krikor - 10-11-2021, 04:16 PM
RE: Chopping a path - by Ottia Tuota - 10-22-2021, 08:37 AM

Forum Jump: