Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Path transformations
#27
(08-07-2020, 12:06 PM)Ottia Tuota Wrote:
(08-07-2020, 08:23 AM)Ofnuts Wrote: For the quadrangle one, it appears to be the same a Gimp's perspective (the basic transforms: rotate, scale, shear, perspective, flip, as well as the Unified transform that combines manyl of them are all affine transforms). Then you shouldn't need to set precision, a property of Bézier curves is that the transform result of the whole curve is the curve produced by the transform of the four control points (this property is what makes Bézier curves so popular despite other shortcomings).

Excuse me, but from where do you know that those Gimp's tools do affine transformations? I would indeed like to know precisely what they do.

To take the perspective transform tool for example, when I apply it to a path, it shows four corner points and one central point, and by moving those points you change the transformation. That central point makes a translation, that is obvious. But what about the four corner points?  Why four? If it were an affine mapping, three points would suffice. Four points are needed to determine a projective mapping.

And there is that 3x3 matrix. (At the upper right corner in the GUI of the perspective tool.) I don't know its function. But I do know that in general such a matrix is associated with any projective transformation, and the transformation is performed by multiplication with the matrix. (More precisely, points in the projective plane are expressed as homogeneous coordinates, and those coordinate vectors are what are multiplied by the matrix.)

If I now just assume that that 3x3 matrix in the GUI indeed is exactly that same matrix that I have learned from general theory (which I don't know, this is just guessing), then: If you move the central point (a translation), then what changes in the matrix are the first and second numbers in the right-most column, nothing else. That is precisely what should happen if the guess about the matrices were right. Now, if you change the four corner points, you see that in the matrix you can change all numbers (except the 1 at bottom right corner). But if the mapping where affine, its bottom row should remain as 0,0,1. But the bottom row changes.

So, I am baffled since I don't know the exact definitions of what the Gimp's transform tools do. Until I know better, I stick to the notion that Gimp's perspective transform and some other tools actually perform projective transformations, and that that 3x3 matrix is the one I learned from general theory. It certainly looks like that.

But: If I were correct (big IF), then I would expect that those Gimp's tools would silently do approximation when dealing with paths. Namely, a projective transformation does not send (polynomial) Bézier curves again onto such curves. And approximation would require(?) generating extra control points in paths, but that does not seem to happen! So, instead of an exact projective transformation, paths are mapped in some other manner? That is ok, but how is the mapping done?

Gimp's online documentation gives no definitions. To add to the confusion, in connection with the transform tool it says: "This tool is not actually a perspective tool, as it doesn't impose perspective rules. It is better described as a distort tool." Without any further explanations.

So, as far as I understand, this all is just guessing until we know precise definitions behind Gimp's tools. Until that, I just keep stumbling along as well as I can according to my best understanding. If you can shed any light here, I would be grateful.

OK, so I was wrong... OTOH as far as my tests go:
  • There are indeed cases where the transform of the rendered path is not the rendering of the transformed path, so in all likelihood there is no code to increase the accuracy of the path (and the transformed path has the same number of control points as its source).
   
(black: transform of rendered path, red: path from transformed control points)
  • Still, in most cases (and in particular when the path has been obtained from text), the transform of the rendered path is darn close to the rendering of the transformed path (and in the example below, the font has been picked for not having too many control points, many fonts have many more control points per characters):
   
(green: transformed text, red: path from transformed text path)
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: