Given a chord, how do I find the ellipse? 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.
 A: A general ellipse, with axes parallel to the coordinate axes, is given by an equation of the form
$$u(x-x_0)^2+v(y-y_0)^2=1.$$
The ellipse is symmetric w.r.t. the $x$-axis so $y_0=0$, and because $(-a,0)$ is the center of the ellipse we have $(0,0)$ and $(-2a,0)$ on the ellipse, so $x_0=-a$ and $u=\frac{1}{a^2}$ (I will assume that $a\neq0$ throughout). Hence the ellipse is given by
$$\frac{1}{a^2}(x+a)^2+vy^2=1,$$
for some parameters $a$ and $v$ that are yet to be determined. 
Given two points $(p_x,p_y)$ and $(q_x,q_y)$ that define the wall, we want the ellipse to pass through their midpoint 
$$(r_x,r_y):=\left(\frac{p_x+q_x}{2},\frac{p_y+q_y}{2}\right),$$
which means that
$$\frac{1}{a^2}(r_x+a)^2+vr_y^2=1.$$
This already allows us to express $v$ in terms of $a$ as
$$v=\frac{1-\frac{1}{a^2}(r_x+a)^2}{r_y^2}=-\frac{r_x^2+2ar_x}{a^2r_y^2},\tag{1}$$
where we assume that $r_y\neq0$. Then it remains to determine $a$.
The tangent line to the ellipse at the point $(r_x,r_y)$ can be found by implicit differentiation; we find
$$\frac{dy}{dx}(r_x)=-\frac{1}{a^2v}(r_x+a),$$
so the tangent line through $(r_x,r_y)$  is given by
$$y=-\frac{1}{a^2v}(r_x+a)(x-r_x)+r_y,$$
where we assume that $v\neq0$. The normal is obtained by multiplying the coefficient of $x-r_x$ by $-1$. Plugging in expression ($1$) for $v$, the equation for the normal is
$$y=\frac{r_y^2(r_x+a)}{r_x^2+2ar_x}x-\frac{r_y^2(r_x+a)}{r_x+2a}+r_y.$$
This must equal the equation for the line through $(p_x,p_y)$ and $(q_x,q_y)$, which is given by
$$y=\frac{q_y-p_y}{q_x-p_x}(x-p_x)+p_y.$$
This yields the two equations
$$\frac{r_y^2(r_x+a)}{r_x^2+2ar_x}=\frac{q_y-p_y}{q_x-p_x}
\qquad\text{ and }\qquad
-\frac{r_y^2(r_x+a)}{r_x+2a}+r_y=\frac{p_yq_x-p_xq_y}{q_x-p_x}.$$
These can be rewritten into two (equivalent) linear equations in $a$. Solving yields
$$a=\frac{(q_y-p_y)r_x^2-(q_x-p_x)r_xr_y^2}{(q_x-p_x)r_y^2-2(q_y-p_y)r_x}.$$
With this we can also compute $v$ by means of equation ($1$), and hence the equation for the ellipse.
A: 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.
A: Just exploit the principle that an ellipse is a stretched circle.
Let $P$ our point, $\tau$ the known tangent through $P$, $O$ the center of the ellipse.

We find the $x$-compression factor sending the ellipse into a circle in the following way:


*

*we define $R$ as the intersection between $\tau$ and the $y$-axis and we draw the circle having $OR$ as a diameter;

*we define $Q$ as the point with a positive abscissa that lies on the previous circle and also on the parallel to the $x$-axis through $P$;

*we draw the circle centered at $O$ through $Q$: this is the ellipse after the compression, and the point $S$ in the picture is one of the vertices of the ellipse;

*we define $T$ as the intersection between the compressed ellipse (i.e. the previous circle) and the positive $x$-axis, $U$ as the intersection between $TQ$ and the $y$-axis (we use this point to scale back the ellipse);

*the intersection $V$ between $UP$ and the $x$-axis is another vertex of the ellipse;

*we draw a circle centered at $S$ with radius $OV$: its intersections with the $x$-axis are the foci of the ellipse.


I leave to you to convert this geometric approach into a formula for the coordinates of $S,V,F_1,F_2$ given the coordinates of $P$ and the slope of $\tau$.
A: Here's a construction that I think is relatively easy to implement.
Find the point $P$ where the tangent at $(-c,d)$ intersects the $y$ axis.
Suppose the coordinates of that point are $(0,p).$
Now find the point $(-\lambda c,d)$ that is at distance $p$ from $(0,p),$
where $\lambda > 0.$
There are various ways to do that, but one is to consider the right triangle
with vertices $(0,p),$ $(0,d),$ and $(-\lambda c,d).$
The length of the hypotenuse should be $p$, so we want
$(d - p)^2 + (-\lambda c)^2 = p^2,$
that is, $\lambda = \lvert\frac1c\rvert\sqrt{p^2 - (d - p)^2}.$
Find the point on the $x$ axis that is the center of a circle through $(0,0)$
and $(-\lambda c,d).$
One way is to consider the line through $(-\lambda c,d)$ and $(0,p),$
find the line perpendicular to that line through $(-\lambda c,d),$
and find the intersection of the perpendicular line with the $x$ axis.
Let's say the point you find in this way is $(-a',0).$
Now you just need to "stretch" the circle you've just found in a horizontal direction while keeping it tangent to the $y$ axis.
Stop when the point $(-\lambda c,d)$ on the circle has been "stretched" onto the point $(-c,d).$
The ellipse you get by "stretching" the circle this way will then be tangent to the desired line through $(-c,d).$
The factor by which you need to "stretch" is just $\frac1\lambda,$
so $a = \frac {a'}\lambda.$
"Stretching" doesn't alter the "height" of the circle/ellipse, so
$b = a'.$
It is possible for this construction to fail, in particular if $p < \frac d2.$
But in that case there is no ellipse matching the one you want.
The two given points and their tangent angles (robot starting and ending configuration)
and the given orientation of the axes of the ellipse (parallel to the $x$ and $y$ axes) can overconstrain the ellipse.
