Test if a vector is pointing towards the center of an ellipse

91 Views Asked by At

I have an ellipse :

$$x = h + a\cos t \cos\theta - b\sin t \sin\theta \\ y = k + b\sin t \cos\theta - a\cos t \sin\theta$$

Let's say if we have a normal vector $n$ to the ellipse, on a point $p$ (also on the ellipse). Is there a formula to calculate if $n$ points towards the center $(h,k)$ or away from it? (As in the vector points inwards, rather than outwards).

2

There are 2 best solutions below

0
On

General parametric form

An ellipse in general position can be expressed parametrically as the path of a point $(X(t),Y(t))$, where

$X(t)=X_c + a\,\cos t\,\cos \varphi - b\,\sin t\,\sin\varphi$

$Y(t)=Y_c + a\,\cos t\,\sin \varphi + b\,\sin t\,\cos\varphi$

as the parameter t varies from 0 to 2π. Here $(X_c,Y_c)$ is the center of the ellipse, and $\varphi$ is the angle between the X-axis and the major axis of the ellipse.

Center coordinate is $C(h,k)$ and $P(x_0,y_0)$ so the slope of the line that contains this two point is $$m=\frac{y_0-k}{x_0-h}$$ The slope of the tangent (which your vector is also perp. to it) to the ellipse at $P$ is $$(\frac{dy}{dx})_{x_0,y_0}$$ which is equal to $$\frac{dy}{dt} \div \frac{dx}{dt}$$ Theese two lines(first and the tangent) shoul be perpendicular for your question so the product of slopes should be $-1$ $$(\frac{dy}{dx})_{x_0,y_0} = -\frac{x_0-h}{y_0-k}$$ Take the derivative and put your point into the equation.

0
On

I have found a way around this.

Basically there are 2 possible line segments formed by 2 normals $n_1, n_2$, at $180$ degrees from each other:

$$ l_1 = {\bf P_0} + k{\bf n_1} \\ l_2 = {\bf P_0} + k{\bf n_2} \\ $$

So if the solution of a line segment, with the ellipse, has a solution such that $k>0$, this implies intersection, which implies inward pointing.

Thus the correct solution will be the normal corresponding to the other line segment.