# Mapping an Ellipse to a Circle with the Circle's center offset inside the Ellipse

I am creating a program which maps an Ellipse to a Circle. However, there is a twist, the center of the Circle is offset inside the Ellipse. See this picture: Ellipse and Circle

In this picture the red dot inside the ellipse is the location of the Circle's center in the Ellipse. So, I know the dimensions and centers of both the Circle and the Ellipse and the center point of the Circle inside the Ellipse. Now, how would I go about mapping points inside this Ellipse to a Circle?

Edit:

Sorry for not clarifying my question. Yes, I meant that the red dot in the Ellipse is the Circle's center mapped into the Ellipse.

I took a while to reply but I haven't been slacking off, I already implemented the solution given by you people.

As Aretino mentioned, I used Homography to solve this problem. See: http://www.corrmap.com/features/homography_transformation.php

If only I had checked this page more often, I would have known that Linear Transformation would have been far more simpler. So for everyone with this problem, use Linear Transformation as described by Aretino. I will be using it to make my program simpler.

Thank you all so much for helping me out. Here is the end result of your effort: :)

https://youtu.be/EvBG166Ly6Y

• To "map" one figure to another in a coordinate plane (you are working in Cartesian coordinates, right?) means you have in mind some kind of function that takes coordinates $(x,y)$ which could be anywhere in the first figure and maps them to points in the second figure. Note that technically this is satisfied if you choose one point of the circle and make your function return that point no matter what input it receives. You probably have something different in mind. You can still edit the question to explain what you are thinking. – David K Sep 21 at 11:45
• You van use for instance a suitable homography. – Aretino Sep 21 at 17:20
• +1 for coming back to us with that nice video – TonyK Sep 22 at 15:51

If point $$O$$ is to be mapped to the centre of the circle, let $$EF$$ be the diameter of the ellipse through $$O$$. Draw tangents $$AB$$, $$CD$$ through $$F$$ and $$E$$ and draw $$GH$$ through $$O$$ parallel to both tangents. Draw then tangents $$BC$$, $$DA$$ through $$G$$ and $$H$$. There is a homography mapping the ellipse to the circle, point $$O$$ to the center $$O'$$ of the circle and trapezoid $$ABCD$$ to square $$A'B'C'D'$$.

To find the transformed of a point $$P$$ inside the ellipse, you can exploit the invariance of cross-ratios in a homography. For instance, draw line $$OP$$ intersecting two opposite sides of the trapezoid at $$R$$ and $$Q$$. From $$(A,B;F,Q)=(A',B';F',Q')$$ you can find $$Q'$$ and then from $$(R,Q;O,P)=(R',Q';O',P')$$ you can find $$P'$$.

As this is a linear transformation (in homogeneous coordinates) you can also find a transformation matrix from four couples of corresponding points (e.g. points $$EFGH$$ and $$E'F'G'H'$$).

Here is a sketch of a sequence of transformations that will do what you want.

For fixed $$p$$ between $$0$$ and $$1$$ the quadratic function $$f(t) = p + t - pt^2$$ maps the interval $$[-1,1]$$ to itself, fixing the endpoints and moving $$0$$ to $$p$$.

For fixed $$r$$ the function $$rf(t)$$ scales that behavior to the interval $$[-r,r]$$.

Now consider the unit circle in the plane and apply that function to the $$y$$ coordinate on each vertical chord. That will map the disk smoothly to itself, moving the origin to $$(0,p)$$.

Now just stretch that circle by $$1/a$$ and $$1/b$$ along the coordinate axes to turn it into an ellipse.

• It's not entirely clear what OP wants, but the question does say "to a circle", not "to an ellipse". It also says the red dot is the circle's center, not that the circle's center is mapped to that point. Of course, it is then very strange that the circle is drawn somewhere else and not simply shown in place with the red dot at its center. So I suppose it is possible that you have interpreted the figure correctly and the description in the question is wrong. That's yet another reason OP should edit the question to explain it better. – David K Sep 21 at 15:43

A different idea: Let $$P$$ be any point to inside a circle $$C$$ apart from the center. Construct perpendicular bisectors between $$P$$ and various points on $$C$$. These lines are tangent to an envelope curve, which is an ellipse having one focus at $$P$$ and the second focus at the center of $$C$$. If you want a point by point mapping: each point on $$C$$ produces a unique point of tangency on the envelope po e ellipse when the perpendicular bisector corresponding to that point is constructed.