07-13-2020, 06:15 AM

(07-12-2020, 11:33 PM)Ofnuts Wrote: I find it complicated to use. I don't see much purpose in the "base" and "target". You can make things simpler with one less path. You would have:

1. The source path

2. The "shaper"

3. A rectangle.

The transform maps the rectangle to the shaper. In the nominal use, the rectangle frames the source path. Benefits: the rectangle can be implicit, and can be for instance the bounding box of the source path (max/min x,y of the anchors, or anchors and tangents) or defined by guides, or the selection... See for instance https://www.gimp-forum.net/Thread-ofn-bend-path

What makes the fast algorithm faster?

True. That would be more simple to use, and that would be an advantage. Something similar you can get by using the Shaper as the Target and drawing the Base rectangle around the source path (true, that could be implicit).

But this way it is more flexible. Where the transformed path will be located, is independent of the Shaper. The Base and the Target determine the movement. The Shaper determines the shape.

Also, if you use 4-anchor Base and Target, neither needs to be a rectangle, not even the Base. They may be skew quadrilaterals. So, from a single Shaper you get different effects by changing the forms of the Base and the Target.

But it might be good to make such simpler version. I'll look into it.

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.

By the way, Inkscape can draw parametric curves as paths. I looked at it once (not the current version, that was some time ago). It seemed to me that it used such simple 1/3 rule or something similar. So, to get accurate results, you must put control points densely. That approximation is a non-trivial problem.