0
$\begingroup$

Here is what I know:

The location of the center of the ellipse C (20,10).
The Major axis (2a) or 400 (a being 200) - this is on the X axis.
The Minor axis (2b) or 200 (b being 100) - on the y axis.
The Angle of the line. The line segment which x1,y1 = C (20,10) the center of the cirle and x2,y2 (1200,800).
The Ellipse is not rotated.

I'm attempting to draw an arrow in delphi from the center of this ellipse to a point (and have it start at the ellipse and not in the center). The ellipse will eventually move and the arrow could point in any direction.

Thank you in advance for any help. And for what it is worth, I did search and read everything I could find similar to this question.

$\endgroup$
  • $\begingroup$ Do you know the equation of the ellipse and the equation of the line that passes through two points? Just write them down and solve the system of two equations with two unknowns. BTW: your description does not make clear if the "minor" axis of the ellipse is in $x$ or in $y$. $\endgroup$ – leonbloy Apr 24 '12 at 0:47
1
$\begingroup$

Here's a reasonable method: translate everything such that the center of the ellipse is at the origin. Consider the intersection of the ellipse with major axis $2a$ and minor axis $2b$ with the polar equation

$$r=\frac{a b}{\sqrt{b^2\cos^2\theta+a^2\sin^2\theta}}$$

and the line $\tan\,\theta=\dfrac{y_2-y_1}{x_2-x_1}$. (When solving the last equation for $\theta$, you will want to use the two-argument arctangent that is implemented in most computing environments.) Once having computed the corresponding values of $r$ at $\theta$ and $\pi+\theta$, convert to rectangular coordinates and translate back to your initialal origin.

$\endgroup$
  • $\begingroup$ Thank you SO much for this answer. It turns out I already knew the angle and just had to get the distance (r). $\endgroup$ – opsin Apr 25 '12 at 0:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.