On Fri, Dec 7, 2018 at 4:15 PM Alan Braslau
On Fri, 7 Dec 2018 09:06:03 +0100 "Mikael P. Sundqvist"
wrote: 2) Support for transforming images in a more general way. With the zscaled, slanted, ... we are able to transform any object in an affine way. It would be nice to be able to transform any object in a more general way (i.e. by a mapping defined by the user). The example code below shows what happens in the complex plane with a grid and a curve when the mapping z to z^2 is applied.
I have generalized my rewrite of the MP graph macros to handle any arbitrary mapping from data space to drawing (2D) space. At present, I have only considered the simple functions of log (and sqrt) scales as well as polar coordinates (x,y) = f(theta,r) with f(theta,r) = (r sin theta, r cos theta) as I have real use cases for these.
Sounds interesting. Do you have any "test document" to show the work in progress?
I also consider a simple 3D->2D mapping.
That sounds awesome!! The time working with colors as 3D might come to an end! :)
It would be very easy to transform z = a+ib to z^2 for example, as you show,
The approach transforms a picture, applying to all stroked and filled paths, as well as to the *position* of text objects. I have not looked into somehow transforming a bitmap image.
You emphasize "position". Does it mean it will not be possible to transform the shape of the letter?
Perhaps I am missing something, but I'm not able to apply this to a piece of text for example, or to apply it directly to a picture. Instead, I have to loop over all separate paths. I think the ideal would be to have a "ftransformed" (or with some other name), and then just define a function (as fun in the example below), and then be able to do "draw X ftransformed fun;", where X is some(any?) general object. Is that doable?
for i within pic : ... endfor
So, yes, easy to write a primary (but I don't like the name "ftransformed"). Using lua helpers can make this efficient.
OK, looping through the pic sounds like a good idea. The word ftransformed was made up while writing the email, and I agree it is not good (perhaps "mapped" is better). I trust that you will come up with something that fits well.
Alan
Yet another wish: 3) It would be nice to be able to plot some special functions. I'm thinking of the usual suspects, Airy, Bessel, Hypergeometric, Laguerre, Legendre, ... Could it be that one could have support via some lua library? /Mikael