Jump to content

How polar inversion works ?


Recommended Posts

Hi, i'm wondering how polar inversion works. is Paint.net setting the r coordonate with the x and set ϕ to y (eg: A (x, y) -> A' (1/x, y). I don't know where the inversion goes, but i'm 90% sure the effect invert the "r coordonate" cause the center is infinite. Also i don't know what the "quantity parameter" do :(

I want to reproduce the effect with python to modify some things cause i want another result (like increasing quantity to -10 or more)


Thanks for reading


Link to comment
Share on other sites

Here is the disassembled transform code:


		protected override void InverseTransform(ref WarpEffectBase.TransformData data)
			double x = data.X;
			double y = data.Y;
			double invertDistance = DoubleUtil.Lerp(1.0, base.DefaultRadius2 / (x * x + y * y), this.amount);
			data.X = x * invertDistance;
			data.Y = y * invertDistance;


That's the transformation that's applied to each subpixel. It takes the destination subpixel address and calculates the corresponding source subpixel address. The Quality setting determines the number of subsamples per pixel. The total subsamples per pixel is Quality squared, since that's the number of subsamples in each direction. So a setting of 10 would compute 100 subsamples per pixel.  The X and Y values are floating point, not ints, to allow the transform to process subpixels.


Lerp linearly interpolates between the first (1.0)  and the second value, to determine the strength of the effect.


The default radius is half the minimum of the height and width. DefaultRadius2 is that value squared.



  • Upvote 1
Link to comment
Share on other sites

I think it might be easier to write a plugin using CodeLab then it would be to use Python. Also, as I recall, Python is an interpreted language, so doing 100 subsamples per pixel would probably run like a dog (or I should say, "run like a tortoise" -- dogs run pretty darned quickly).

Link to comment
Share on other sites

image.thumb.png.e8235fb904c48687e4e11220121e9662.pngFinaly i found a way faster way to do it xD I use some of my hacker skill to inject a "multiply by 8" in the code to do what i wanted.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...