Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Path transformations
#12
(07-13-2020, 06:15 AM)Ottia Tuota Wrote: The plugin is slow because of the approximation that is needed. If the source path is a Bezier curve of degree 3, the transformation makes it into a curve of degree 9. To draw it with Bezier curves, an approximation must be used. To that end, the plugin uses my own algorithm (that certainly should be much better and faster).  

The simple algorithm is fast since it is simple. It does not even try to approximate. If you choose the algorithm by putting the input number =1, it uses the following simple rule: When it sees an arc that should be drawn, it sets the end points exactly right, and it sets the tangent directions at the end points exactly right. But the handle lengths are set simply to be 1/3 of the chord length. If the arc curves only mildly, the result may be good, but it may also be quite wrong. The simple algorithm does not care. I shall make an example picture for you when I have the time.

If you choose the simple algorithm by putting the input number >1, what happens is that the algorithm first subdivides the arc into smaller subarcs, and then it uses the simple rule on the subarcs. So the number of control points grows. Try to put input =8 and see the result.

The slow algorithm ideally gives good approximation with only a small number of control points.

Here is an example picture trying to show what a simple algorithm and the good algorithm do.

   

The Path to be transformed is the slightly curvy grid. Each arc is a separate stroke with one anchor at each end. The picture shows the transformed path obtained from the simple algorithm with the input numbers 1,2,4, and also from the good algorithm (input number = 0). The Shaper is deliberately chosen to be difficult (large curvatures).
  • Algorithm=1: Terribly wrong. Here the simple algorithm adds no new control points. It merely maps the original anchors and then uses the 1/3 rule to construct the handles. No effort done to approximate the right curve. (By the 1/3 rule I mean the rule that handle lengths are set to 1/3 of the chord length.)
  • Algorithm=2: Much better but faults are easy to spot. Here the algorithm first makes a subdivision on each segment and only after that uses the 1/3 rule.
  • Algorithm=4: Seen in this size already very good but zoomed in one  still sees faults. And the cost is that there are still more control points.
  • Algorithm=0: The good but slow algorithm.
In addition, the picture shows the cases algorithm=0 and algorithm=4 with the anchors made visible. The point is that the algorithm=4 gives a good result but with unnecessarily many control points. The algorithm=0, on the other hand, gives a good result but with fewer control points (though there are more than in the original Path).

I also made the experiment (not shown in the picture) that I let the plugin draw two of these cases on top of each other: the case algorithm=0 and the case algorithm=4. That way I could compare the results, and I saw that in some spots there were clear discrepancies. Then I did the same with algorithm=0 and algorithm=8, and I saw no differences in the curves, so it is clear that the approximation algorithm (input=0) did very good work. But the path from algorithm=8 was literally covered by anchors. The conclusion: The good and slow algorithm produced a good result even if slowly.
Reply


Messages In This Thread
Path transformations - by Ottia Tuota - 04-22-2020, 10:34 AM
RE: Path transformations - by Ottia Tuota - 04-22-2020, 12:27 PM
RE: Path transformations - by Ottia Tuota - 04-24-2020, 10:28 AM
RE: Path transformations - by Zero01 - 04-24-2020, 09:25 PM
RE: Path transformations - by Ottia Tuota - 04-26-2020, 06:36 AM
RE: Path transformations - by Ottia Tuota - 05-04-2020, 10:01 AM
RE: Path transformations - by Ottia Tuota - 06-08-2020, 11:08 AM
RE: Path transformations - by Ottia Tuota - 06-09-2020, 05:08 PM
RE: Path transformations - by Ottia Tuota - 07-12-2020, 12:50 PM
RE: Path transformations - by Ofnuts - 07-12-2020, 11:33 PM
RE: Path transformations - by Ottia Tuota - 07-13-2020, 06:15 AM
RE: Path transformations - by Ottia Tuota - 07-13-2020, 05:15 PM
RE: Path transformations - by Ottia Tuota - 07-14-2020, 02:23 PM
RE: Path transformations - by Ofnuts - 07-14-2020, 04:02 PM
RE: Path transformations - by rich2005 - 07-15-2020, 09:20 AM
RE: Path transformations - by Ottia Tuota - 07-15-2020, 11:38 AM
RE: Path transformations - by Ottia Tuota - 07-16-2020, 11:42 AM
RE: Path transformations - by Ottia Tuota - 07-26-2020, 07:26 AM
RE: Path transformations - by Ottia Tuota - 08-05-2020, 06:13 PM
RE: Path transformations - by Ottia Tuota - 08-07-2020, 07:25 AM
RE: Path transformations - by Ottia Tuota - 08-11-2020, 08:39 AM
RE: Path transformations - by Ofnuts - 08-07-2020, 08:23 AM
RE: Path transformations - by Ottia Tuota - 08-07-2020, 12:06 PM
RE: Path transformations - by Ofnuts - 08-08-2020, 12:58 PM
RE: Path transformations - by Ottia Tuota - 08-08-2020, 01:33 PM
RE: Path transformations - by mahvin - 08-07-2020, 01:55 PM
RE: Path transformations - by Ottia Tuota - 08-07-2020, 07:26 PM
RE: Path transformations - by mahvin - 08-07-2020, 07:56 PM
RE: Path transformations - by Ottia Tuota - 08-07-2020, 08:15 PM
RE: Path transformations - by Ottia Tuota - 09-03-2020, 11:43 AM
RE: Path transformations - by Ottia Tuota - 09-04-2020, 11:29 AM
RE: Path transformations - by Ottia Tuota - 09-19-2020, 01:00 PM

Forum Jump: