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:
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: :)
$\endgroup$ 33 Answers
$\begingroup$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'$).
$\endgroup$ 3 $\begingroup$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.
$\endgroup$ 1 $\begingroup$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.
$\endgroup$