Mapping points in a rectangle inside an ellipse

Let's say that an ellipse is inscribed in a rectangle and their center $$(0,0)$$ is therefore the same. I am trying to find a function that maps every point $$(x_{r},y_{r})$$ from the area of the rectangle (with known dimensions) to a point $$(x_{e}, y_{e})$$ inside the area of the ellipse (with minor axis equal to the height and major equals to the width of the rectangle, being inscribed to it).

So points on the edge of the rectangle map to the edge of the ellipse, and points inside the rectangle map inside the ellipse (e.g. all the points along the major/minor axis would map directly).

• Are there any other properties that you’d like this mapping to have? If not, you could cast a ray through the point and scale by the ratio of the distances to its intersections with the ellipse and rectangle.
– amd
Oct 10 '18 at 22:01

Assume the width of the rectangle equals $$2a$$, and the heigth $$2b$$. Then $$\begin{cases} x = a r \cos t \\ y = b r \sin t \end{cases} \quad \text{with t\in[-\pi,\pi], r\in[0,1],}$$ parametrises the full ellipse. So all we still need is a map that maps the rectangle $$[-a,a]\times[-b,b]$$ to $$[-\pi,\pi]\times[0,1]$$. One example is the map $$(x,y)\mapsto (\frac{\pi}{a}x, \frac{1}{2b}y+\frac{1}{2})$$. Composing this with the parametrisation, gives $$(x,y)\mapsto \left(a\Bigl(\frac{1}{2b}y+\frac{1}{2}\Bigl)\cos(\frac{\pi}{a}x),b\Bigl(\frac{1}{2b}y+\frac{1}{2}\Bigr)\sin(\frac{\pi}{a}x) \right).$$