Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Squaring the circle, circling the square
#1
Hi all, 
Does anybody happen to have a neat solution to the following problem, please?

I'm trying to take a circular selection and then map it to a rectangular space - rather like this image

[Image: starbucks.png] 
from Squircles' mapping a circle to a square post, in fact.

(And vice versa - what's the point if you can't get yourself back to where you came from?)

I was investigating the Lighting Effects filter's Environment Map section to see if there wasn't a blog post in it, and found that something similar to the operation I'm now interested in is carried out in selecting the source of the environment map to use. Then I found I couldn't duplicate the effect easily to illustrate the concept, even after tinkering with G'MIC's Deformations/Conformal Maps function, which looked like the sort of thing that might do the trick. 

Yes, I could get myself together to understand and write the thing, but I left coding behind a few years ago and I could spend several months teaching myself to Do This Properly in a new language, whereas what I need is to get something written about it sooner than later; if somebody has already invented the wheel (possibly by morphing something square) then it would be of immense help. Can anybody cast some light?
Reply
#2
I see two filters that are close, "Lens Distortion" and "Whirl & Pinch". Since the source code is available, the coding effort wouldn't be too hard.
Reply
#3
(08-15-2017, 10:51 PM)Ofnuts Wrote: I see two filters that are close, "Lens Distortion" and "Whirl & Pinch". Since the source code is available, the coding effort wouldn't be too hard.

It took seventeen iterations to get Lens Distort close.

I'll skip the code for now - maybe in a month or so when I start getting some sensible sleep again.

Thanks for checking it out!
Reply
#4
You could try also IWarp.
Reply
#5
(08-16-2017, 05:41 AM)dinasset Wrote: You could try also IWarp.

I couldn't see how IWarp was going to do the trick without distortion, to be honest - can you suggest how to go about it? I find it great for tweaking, but it seems a bit imprecise for what I'm aiming for.  For example, you can Grow an image to make it look like you've placed it on a sphere, or you can Map/Map Object/Sphere. 
Thanks for the suggestion though - I see where you're coming from :-)
Reply
#6
(08-16-2017, 05:41 AM)dinasset Wrote: You could try also IWarp.

I couldn't see how IWarp was going to do the trick without distortion, to be honest - can you suggest how to go about it? I find it great for tweaking, but it seems a bit imprecise for what I'm aiming for.  For example, you can Grow an image to make it look like you've placed it on a sphere, or you can Map/Map Object/Sphere. 
Thanks for the suggestion though - I see where you're coming from :-)[/quote]

If you are looking for a perfectly "geometrical" result, yes, you're right, it's a bit imprecise.
If you are looking fo something more freely "artistic", you can get them.
   
Reply
#7
Hello there,
I've just implemented this transform as a G'MIC filter, available after a filter update in **Deformations / Circle to square**.
I hope this will be useful. Let me know.

[Image: zQzWrBf.png]
Reply
#8
(08-15-2017, 11:21 PM)QuinB Wrote:
(08-15-2017, 10:51 PM)Ofnuts Wrote: I see two filters that are close, "Lens Distortion" and "Whirl & Pinch". Since the source code is available, the coding effort wouldn't be too hard.

It took seventeen iterations to get Lens Distort close.

I'll skip the code for now - maybe in a month or so when I start getting some sensible sleep again.

Thanks for checking it out!

When I said close, I meant "doing similar things so the code would not be too difficult to change to implement your transform". Smile
Reply
#9
Quote:...a filter update in **Deformations / Circle to square**.

..and here was I playing around trying to find a suitable equation for use in gmic conformal maps Wink
Reply
#10
Big Grin 
(08-16-2017, 12:03 PM)rich2005 Wrote:
Quote:...a filter update in **Deformations / Circle to square**.

..and here was I playing around trying to find a suitable equation for use in gmic conformal maps Wink

I've finally renamed it to Square to Circle instead Big Grin
In case you are looking for it !
Reply


Forum Jump: