Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Replicating a path
#26
I continue with the plugin "Replicate path along another path". Here I first explain a little the idea behind the plugin. Somebody may be interested. Then I mention some problems you may encounter.

The idea behind the plugin very roughly

Very much simplified the idea is as follows. Let tapering=0. Assume that the Base path is the red horizontal line segment and the Source path is the upright line segment in this picture:

   

Imagine there a coordinate system where the end points of Base are (0,0) and (1,0). Let (x,y) be the coordinates of the uppermost point of Source. Then the length of Source is y and it is located at x-coordinate x. We should map the Source somehow to the Target as several copies. Let us first look at one copy only. And let us look how the point (x,y) is mapped.

   

We find on the Target a point based on x and the number of the copy (no details now). From that point we shoot up a perpendicular. From that perpendicular we take a point F(x,y) at distance=y scaled suitably. That point F(x,y) is to where (x,y) is mapped.

And here is the picture when we make several copies. The procedure for each copy is the same except that the chosen point on the Target varies.

   

And that was the basic idea in how the mapping of points is done. However, this is not nearly all since we are making paths, not raster pictures. But I stop here.

Problems

The next picture tries to show two possible problems:

   

If there is too tight a bend the pattern starts to fold on itself. This problem is inherent in the task, and solving it would require a completely different approach, a quite different way to do the mapping. And then the resulting paths would look quite different.

If the Target is not smooth the result may be non-sensical. It can even be something very wild. This problem is probably partly due to my implementation.

To avoid such difficulties: In the Target path avoid:
  • too tight bends;
  • anchors where the path is not smooth;
  • zero length handles anywhere;
  • too abrupt changes of curvature, for example "hooks" at stroke ends.
Also, the Base path should be in the close vicinity of the Source path. Abrupt changes of curvature in the Target may cause faults. And faults may appear at stroke ends if the Base is narrower than the Source, as in the following example:

   

The best remedy is to correct such faults manually, unless one is willing to modify the Target path (in this example it would help to make the Target very straight at the problematic stroke end).

Remark

Gimp has the tool "Text along path". Its working is so similar that I think somebody might have taken its code and made it into a tool "Path along path" or "Replicate path along path". Then no need for anybody to write 2600 lines of Python for the same job. That nobody has done it(?) or published(?) might be due to precisely such difficulties: the tool would not be so nicely behaving that it could be offered as a production version. This is just another guess.
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: