TITLE: Given a chord, how do I find the ellipse?
QUESTION [6 upvotes]: It will explain my use case at the end, in case I am approaching this wrong, but I will start with the math question.
Given:

a point $\rm P$ on an ellipse;
the slope of the tangent (or normal) to the ellipse at $\rm P$; and
the horizontal and vertical distances from the ellipse’s center and $\rm P$,

how I can mathematically represent the ellipse?
I'm sure that was unintelligible, so pictorally, here is the situation:

As you can see, for simplicity, I've taken the liberty of placing the ellipse where the center is on the x-axis, because that works for me.  I've made my fixed point on the horizontal x-axis at the origin, also for simplicity (you'll see why later).  I know the location of the point on the ellipse $(-c, d)$, and I know the angle/slope of the normal at that point (which I've called $\phi$, and therefore also the tangent.  Since I have made the ellipse pass through the origin, I know the center of the ellipse is at $(-a, 0)$.  However, I am struggling to determine the values of $a$ and $b$ that I need to complete the equation for the ellipse.
Here's my actual use case: there's a rectangular robot, and a target that I want to drive to.  That target is on a wall, which is likely at an angle to robot.  I want the robot to arrive at the wall with the front of the robot flat against the wall, meaning that direction the robot travels the instant it touches the wall is perpendicular to it.  I thought that I should be able to follow the elliptical arc for a nice, smooth path to achieve that.  But to do that, I need to represent the ellipse mathematically.
Basically, here's what I'm looking to do:

I know the points $(u, v)$ and $(x, y)$, relative to the robot, that are on the target wall, equidistant from the target point itself, and can therefore identify the location of the target, and the angle/slope of the target wall.  I could also easily flip that to identify the tangent at that point.
I want to identify that magenta path so that I can have the robot follow it.  I want to do this computationally on the fly, which also means I can't plug values into an equation and solve "interactively".
By looking around this site, I've found that the equation for the normal at $(X, Y)$ is: $\frac{(X-h)(y-Y)}{a^2}-\frac{(x-X)(Y-k)}{b^2}=0$, which in my case means that: $\frac{(-c+a)(y-d)}{a^2}-\frac{(x+c)d}{b^2}=0$, but I cannot get much further than that, and could really use some help.

REPLY [2 votes]: If I understand your question properly, we know a point $P=(-c,d)$ on the ellipse, with its tangent line, we also know vertex $A=(0,0)$ of the ellipse and that its major axis lies on the $x$-axis, but we don't know the position of the other vertex $(-2a,0)$, nor of the ellipse center $(-a,0)$. 
The equation of the ellipse is:
$$
{(x+a)^2\over a^2}+{y^2\over b^2}=1,
$$
where semiaxes $a$ and $b$ are to be found. Plugging there the coordinates of point $P=(-c,d)$ gives a first equation:
$$
{(a-c)^2\over a^2}+{d^2\over b^2}=1.
$$
Another equation can be deduced by equating $dy/dx$ at $P$ to the known slope $m$ of the tangent:
$$
m=-{a^2\over b^2}{a-c\over d}.
$$
Combining those two equations we can eliminate $b$ and find an equation for $a$:
$$
a={3c^2\pm\sqrt{c^4-8mcd^3}\over 4c},
$$
where the $+$ has to be chosen if $m<0$ as in your diagram.