08-07-2020, 07:25 AM
Now a couple of words and two pictures about the two small plugins "Fit a path in a triangle" and "Fit a path in a convex quadrangle". These arouse just as by-products. I have no idea if anybody will find them useful.
The first plugin:
The plugin performs a transformation called dilation to place and fit the given path in the given triangle. Dilation means translation plus scaling. So, no rotation or distortion. This plugin involves no approximation since the mapping is affine, so it can be made just by mapping control points.
The second plugin:
The transformation done here is what mathematicians call a projective transformation. I believe other people coming from different backgrounds may call it a perspective transformation. It is, I believe, almost the same as Gimp's tool perspective transform (but then I don't know what that one actually does).
As you see from the picture, the path is fitted in the given quadrangle, but in the process it is clearly distorted.
Looking at the picture you are likely to notice that the accomplished fitting is not the only possible. An infinite number of different fittings could be done when distortion is allowed. The plugin implements just one particular choice. Imagine the bounding box of the path drawn there; it is that box which is deformed into the shape of the quadrangle, and the path is deformed along with it.
(To make the plugin more general, to allow the user to choose from those infinitely many other possibilities, would mean complicating things again... I might be doing that next.)
Also, when applied to Bézier curves, the latter plugin necessarily does approximation; that is why this plugin offers choice of the algorithm. But please note that the plugin is not perfect and the fitting may not be exact with the default algorithm (=4). You may set the algorithm number higher or set it to 0 (slow). Even then nothing is guaranteed.
The first plugin:
The plugin performs a transformation called dilation to place and fit the given path in the given triangle. Dilation means translation plus scaling. So, no rotation or distortion. This plugin involves no approximation since the mapping is affine, so it can be made just by mapping control points.
The second plugin:
The transformation done here is what mathematicians call a projective transformation. I believe other people coming from different backgrounds may call it a perspective transformation. It is, I believe, almost the same as Gimp's tool perspective transform (but then I don't know what that one actually does).
As you see from the picture, the path is fitted in the given quadrangle, but in the process it is clearly distorted.
Looking at the picture you are likely to notice that the accomplished fitting is not the only possible. An infinite number of different fittings could be done when distortion is allowed. The plugin implements just one particular choice. Imagine the bounding box of the path drawn there; it is that box which is deformed into the shape of the quadrangle, and the path is deformed along with it.
(To make the plugin more general, to allow the user to choose from those infinitely many other possibilities, would mean complicating things again... I might be doing that next.)
Also, when applied to Bézier curves, the latter plugin necessarily does approximation; that is why this plugin offers choice of the algorithm. But please note that the plugin is not perfect and the fitting may not be exact with the default algorithm (=4). You may set the algorithm number higher or set it to 0 (slow). Even then nothing is guaranteed.