How to calculate how close a fixed point is to an ellipse without derrivatives?

71 Views Asked by At

How can you calculate how close a fixed point is to an ellipse without using derivatives? Using derivatives, this distance can be calculated by plotting the gradient that is perpendicular to the gradient of a line that touches the ellipse and the fixed point, plotting the derivative of the ellipse function and finding where the two intersect. However, because the function for the derrivative include a square root, solving for this intersection is an enormous function.

If the example was determining how close a trajectory, determined by two fixed points, is to and ellipse there is a work around involving scaling the ellipse and coordinates into a circle.

  1. Determine which radii of the ellipse is smaller.
  2. Scale that axis of the graph by the eccentricity of the ellipse (ellipse position, ellipse radius, fixed point positions) such that the ellipse becomes a circle.
  3. Calculate the gradient between the two scaled points.
  4. Calculate the perpendicular gradient to the step 3 gradient.
  5. Plot a line with the step 4 gradient that intersects the center of the circle.
  6. Calculate the the coordinate for the intersection between the step 5 line and the circle, this is point three.
  7. Scale the graph by the inverse of the step 2 factor (including the step 6 point).
  8. Calculate the gradient between the two unscaled, original points.
  9. Plot a line with the step 8 gradient that intersects one of the unscaled, original points.
  10. Calculate the perpendicular gradient to the step 8 gradient.
  11. Plot a line with the step 10 gradient that intersects point three.
  12. Calculate the the coordinate for the intersection between the step 9 line and the step 11 line, this is point four.
  13. Calculate the distance between point three and point four.

This works because a line drawn from the closest point on an ellipse to a fixed point will always be perpendicular to the tangent of the ellipse at that location. Two points provides a gradient, making determining the perpendicular gradient easy. Combining that with the relationship between ellipses and circles makes it very quick, as circles are very easy to work with.

With only a single point, I cannot think of any way to determine what the gradient ought to be. I cannot determine any relationship when scaling the ellipse into a circle either. Does anybody know of any exploitable relationship here that would prevent the need for the derivative calculations?

1

There are 1 best solutions below

2
On

I know that you asked for a method that does not require derivatives. I don't think this is possible. Here's my method, one that uses derivatives.

The parametric equation of any ellipse is of the form

$ \mathbf{p}(t) = \mathbf{C} + \mathbf{V} \mathbf{u} $

where $\mathbf{V} = [\mathbf{v_1}, \mathbf{v_2}] $ and $\mathbf{u} = [\cos(t), \sin(t) ]^T $

Given a fixed point $\mathbf{q}$, the square of the distance from $\mathbf{q}$ to $\mathbf{p}(t)$ is

$d^2(t) = (\mathbf{C - q} + \mathbf{Vu} )^T (\mathbf{C - q} + \mathbf{Vu})$

And this expands to

$ d^2 (t) = \mathbf{(C-q)}^T \mathbf{(C - q)} + 2 \mathbf{u}^T \mathbf{V^T (C - q) } + \mathbf{u^T V^T V u } $

And this is a function of the form

$ d^2(t) = f(t) = A \cos(t) + B \sin(t) + C \cos(2 t) + D \sin(2t) + E $

And we want to find $t$ that will minimize $f(t)$; critical points can be found by differentiating to obtain

$f'(t) = - A \sin(t) + B \cos(t) - 2 C \sin(2 t) + 2 D \cos(2 t) $

And setting $f'(t) = 0 $. The roots of this equation are found exactly by defining $ z = \tan(\dfrac{t}{2}) $ , and relating $\cos(t), \sin(t), \cos(2t), \sin(2t) $ to $z$. If you do that, you will end up with a $4$-th degree polynomial equation in $z$, which can be solved for the roots $z_1, z_2, z_3, z_4$, then the critical $t$ values will be $ 2 \tan^{-1}(z_1)$, $2 \tan^{-1}(z_2)$, $2 \tan^{-1}(z_3)$, $2 \tan^{-1} (z_4) $. Finally you need to evaluate the function $f(t)$ at these four points, and determine the minimum of these four evaluations. This the minimum of the squared distance. Take the square root of that, and you will get the distance from $\mathbf{q}$ to the ellipse $\mathbf{p}(t)$.