John Rostron Posted February 11, 2018 Posted February 11, 2018 Conversion of a rectangular image to polar co-ordinates using Equations is not straightforward. A major problem is that the origin of the rectangular Cartesian co-ordinates is the top left, whereas for a polar display, you would typically want the origin on the midline, probably near the bottom. The following equations assume that the origin is in the midline along the x-axis, and at or near the bottom on the y-axis. First select Filter > Distort > Equations and enter: x=w*atan((x-w/2)/(h/a-y))/100+w/2 y=h-sqrt((x-w/2)^2+(h-y)^2) The expression (x-w/2) displaces the horizontal origin to the centre, and the expression (h-y) displaces the vertical origin to the bottom. In the first formula, for x, there is a parameter a, which allows you to scale the polar transformation; reducing the parameter a stretches the image around the circle. The 100 is an arbitrary scaling parameter which seems to work. The expression +w/2 at the end re-centres the image. This seems to be necessary, but I am not sure why. I would have expected to deduct w/2 rather than add it! Here is an original image of the Quantum Leap statue in Shrewsbury: With this transform using the default parameter a, this produces a quadrant. And with the parameter set to approximately 0.6: Here is the Macro: PolarQuadrant.afmacro The first thing the macro does is to unlock the image. I tend to do this automatically in macros. It is probably unnecessary. I ought to be able to give the adjustable parameter a, a name, but I have not been able to do this. John dmstraker, ronnyb and Kasper-V 3 Quote Windows 11, Affinity Photo 2.4.2 Designer 2.4.2 and Publisher 2.4.2 (mainly Photo). CPU: Intel Core i5 8500 @ 3.00GHz. RAM: 32.0GB DDR4 @ 1063MHz, Graphics: 2047MB NVIDIA GeForce GTX 1050
Staff Ben Posted May 2, 2019 Staff Posted May 2, 2019 Try using this for the X equation: x = w*(atan((x-w/2)/(h/(a)-y)))+w/2 There have been a couple of changes. All inverse trig methods return a strict angle value. This defaults to a value in degrees (not radians). I'm not sure what the affect of the /100 was - but removing it seems to improve things. I also can't remember if they used to generate radians or degrees. There is also a bug I've just fixed in relation to copy-paste of your above equations. There appear to be hidden format characters in the strings you've posted. These are also throwing our expression parser. I've now added code to mitigate for hidden characters. dmstraker 1 Quote SerifLabs team - Affinity Developer Software engineer - Photographer - Guitarist - Philosopher iMac 27" Retina 5K (Late 2015), 4.0GHz i7, AMD Radeon R9 M395 MacBook (Early 2015), 1.3GHz Core M, Intel HD 5300 iPad Pro 10.5", 256GB
John Rostron Posted May 2, 2019 Author Posted May 2, 2019 The post above from @Ben relates to my post in Bugs in Photo 1.7 beta. The macros still work in Photo 1.6. I will issue a revised macro when 1.7 is finalised. This might also require revision of some of my other macros. John Quote Windows 11, Affinity Photo 2.4.2 Designer 2.4.2 and Publisher 2.4.2 (mainly Photo). CPU: Intel Core i5 8500 @ 3.00GHz. RAM: 32.0GB DDR4 @ 1063MHz, Graphics: 2047MB NVIDIA GeForce GTX 1050
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.