I wanted to come up with a nice way to map all the points in the square
to the points in the unit circle, such that the points along the axes are unchanged, and the corners get normalized. The way I went about this was to think of a line of constant x (as well as a line of constant y) getting mapped to an ellipse in the circle. So for our first requirement to hold true, the ellipse for some constant x has the equation
Now we want to make sure that points along the curve at the top of the circle (from 45 degrees to 135 degrees) are all accounted for. So for x between -1 and 1, we want the ellipse to pass through the point
So we'll plug that in, and that should give us the b coefficient for our ellipse
So the ellipse for constant x is
Similarly, for a line of constant y, we get the ellipse
Solving the first for x', we get
Plugging this into the second equation gives
and by symmetry we can see that the mapping
takes the square from -1 to 1 on the x and y axes, to the unit circle. Here's a demonstration of that mapping, which shows its effect on various grid lines.
I'd like to find a way to map a cube to the unit sphere. Hopefully I can get that ready for the next post.
Thanks for your work with finding this mapping, it saved a bit of time.
ReplyDeleteHello, just wanted to ask; What will the inverse mapping be like?
ReplyDeleteWhat happens it we want the inverse result, if we got the circle coordinates and we want to obtain the related squared coords??
ReplyDeleteAnd what are the functions that let us to come back to square coordinates?
ReplyDeleteWhat happen if we have circle coords tha we want to turn to their related circle coords??
hi
ReplyDeletewhat about mapping a circle to a square?
thanks
I'm curious, would this work for squares with a longer side length?
ReplyDeletee.g.
-2 <= x <= 2
Simply by changing the final equation to the length of the half extents instead of 1?
Great work!
ReplyDeleteI know this is a really old post, but check this out http://www.math.purdue.edu/pow/spring2012/pdf/problem11.pdf
ReplyDelete