0
$\begingroup$

I have the bounds (x from, x to ...) of an ellipse (and thus its radius and center), x and y of a point A that is in the ellipse and an angle. I want to get point B to which the angle points (from point A) and that lies on the ellipse.

This is what I can do:

center_x = (x_from + x_to) / 2

center_y = (y_from + y_to) / 2

radius_x = center_x - x_from

radius_y = center_y - y_from

How to go on?


@All: Thank you very much! The formula works perfectly well!

  • 0
    Does your ellipse has its semi-axes parallel to the $x$- and $y$-axes?2012-06-09
  • 0
    Yes, if I got you right. x_from, x_to, y_from and y_to is my method to describe the ellipse, as if you draw an ellipse in Windows' Paint program.2012-06-09

2 Answers 2

1

You need to state as an explicit assumption that the main axes of the ellipse are parallel to the coordinate axes -- if that is not true, knowing the extreme $x$ and $y$ values is not enough to describe the ellipse.

However, if we can make the assumption, the way to proceed is as follows. First compute the lengths of the main semiaxes: $$ a = \frac12(x_{\rm max}-x_{\rm min}) \qquad b = \frac12(y_{\rm max}-y_{\rm min}) $$ Then the equation for the ellipse is $$ \tag{*} \left(\frac{x-x_{\rm center}}{a}\right)^2 + \left(\frac{y-y_{\rm center}}{b}\right)^2 = 1$$ Since you also know the angle $\theta$ (between $A$ and your sought point, I assume), you know there's a positive $t$ such that $$ \tag{**} x= x_A+t\cos\theta \qquad y = y_A+t\sin\theta $$ Substitute these expressions for $x$ and $y$ into $(*)$ and you get a quadratic equation in $t$. Solve that, choosing the positive root (which always exists if $A$ is inside the ellipse), and put the resulting $t$ back into $(**)$.

  • 0
    I think his $A$ is not necessarily the center.2012-06-09
  • 0
    @mrf: good catch. Fixed.2012-06-09
  • 0
    @mrf: That's correct.2012-06-09
  • 0
    Thanks! You have pointed out that it's easier to calculate t, which is what I actually want to get. So the last part is obsolete. +++ I replaced x and y in (\*) with the respective terms from (**). Then I tried so solve to t with http://www.wolframalpha.com/examples/Math.html. But the result is VERY long and complex. Is this normal?2012-06-10
  • 0
    @human: "Is this normal?" unfortunately, yes.2012-06-10
1

The ellipse can be described by the equation: $$\left(\frac{x-x_0}{a}\right)^2 + \left(\frac{y-y_0}{b}\right)^2 = 1$$ where $(x_0, y_0)$ is the center and $a$ and $b$ are the lengths of the ellipse's semi-axes (what you call radius_x and radius_y).

If $A = (p,q)$ and the given angle is $\alpha$, then the ray starting at $A$ in the direction $\alpha$ can be described by $$(x,y) = (p + t\cos\alpha, q + t\sin\alpha) \qquad \text{where $t > 0$}.\tag{*}$$

Plug this expression into the equation for the ellipse and solve for $t$. (This will be a quadratic equation; you want its positive root.) Plug this value of $t$ into (*) to get the coordinates of $B$.

  • 0
    Thank you! Can you please explain the format "(x,y)"? (I'm not so familiar with what is common for mathematical thinking.)2012-06-10