Line Intersection with an Ellipse

kylbrrws

New member
Joined
Jul 3, 2014
Messages
3
Hello,

I am a software developer and I need to plot a point on an Ellipse. Unfortunately I am not that good at Math, I've done a lot of research ad still don't quite understand the formulas.

Say my ellipse is centered at: x,y (3,4) and it is a=55, b=125. My line begins at the ellipse center point and goes 30 degrees from the center point until it hits the ellipse path, I need to find the point that it hits the path at.

Can someone show the work that needs to be done in addition to the formula -because this is what trips me up -in comp programming math is expressed very differently.

One additional question - does this formula work for an ellipse centered at 0,0?

-Kyle
 
Hello,

I am a software developer and I need to plot a point on an Ellipse. Unfortunately I am not that good at Math, I've done a lot of research ad still don't quite understand the formulas.

Say my ellipse is centered at: x,y (3,4) and it is a=55, b=125. My line begins at the ellipse center point and goes 30 degrees from the center point until it hits the ellipse path, I need to find the point that it hits the path at.

Can someone show the work that needs to be done in addition to the formula -because this is what trips me up -in comp programming math is expressed very differently.

One additional question - does this formula work for an ellipse centered at 0,0?

-Kyle

The equation of an ellipse whose axes are parallel to x & y axes and centered at (h,k) with semi-axes length of a & b:

(xh)2a2 + (yk)2b2 = 1\displaystyle \dfrac{(x-h)^2}{a^2} \ + \ \dfrac{(y-k)^2}{b^2} \ = \ 1

equation of line going through (h,k) with a slope = m = tan(Θ):

y - k = m * (x - h)

Now calculate the common 'x' and 'y' from the above two equations.
 
So this is what I am seeing from your reply..

m = tan(30)
ellipse = (x-3)^2 / 55^2 + (y-4)^2 / 125^2



I don't understand how to get the x & y
 
So this is what I am seeing from your reply..

m = tan(30)
ellipse = (x-3)^2 / 55^2 + (y-4)^2 / 125^2



I don't understand how to get the x & y


There two equations -

(x-3)^2 / 55^2 + (y-4)^2 / 125^2 = 1

and

y-4 = (1/√3)*(x-3)


and you have two unknowns (x & y)

let

u = x-3 and.................................(1)

v = y-4 .................................(2)

then we have

u^2 / 55^2 + v^2 / 125^2 = 1 .................................(3)

and

v = (1/√3)*u
.........................................................(4)

using (4) in (3), we get

u^2 / 55^2 + u^2 /(3* 125^2) = 1 ..........................(5)

Now solve for 'u' from (5) - use that value of 'u' in (4) and calculate 'v' - then calculate 'x' and 'y' using (1) and (2)
 
Last edited by a moderator:
There two equations -

(x-3)^2 / 55^2 + (y-4)^2 / 125^2 = 1

and

y-4 = (1/√3)*(x-3)


and you have two unknowns (x & y)

let

u = x-3 and.................................(1)

v = y-4 .................................(2)

then we have

u^2 / 55^2 + v^2 / 125^2 = 1 .................................(3)

and

v = (1/√3)*u
.........................................................(4)

using (4) in (3), we get

u^2 / 55^2 + u^2 /(3* 125^2) = 1 ..........................(5)

Now solve for 'u' from (5) - use that value of 'u' in (4) and calculate 'v' - then calculate 'x' and 'y' using (1) and (2)

Can you show me how to get x and y on the other side of the equation..
as in...

x=?
y=?

As I said before - I am not doing this for school or something - so I have really no Math experience on this level ~ when you say "solve for 'u' ", I don't know what to do.
 
One thing that follows from the "circle" definitions of sine and cosine is that if (x, y) is a point on the circle with center (x0,y0)\displaystyle (x_0, y_0) and radius r has parametric equations x=x0+rcos(θ)\displaystyle x= x_0+ r cos(\theta) and y=y0+rsin(θ)\displaystyle y= y_0+ r sin(\theta). Taking θ\displaystyle \theta from 0 to 2π\displaystyle 2\pi

It shouldn't be difficult to see that an ellipse with axes parallel to the x-axis of length L and parallel to the y-axis of length H is given by x=x0+Lcos(θ)\displaystyle x= x_0+ L cos(\theta) and y=y0+Hsin(θ)\displaystyle y= y_0+ H sin(\theta).

A line that goes through (x0,y0)\displaystyle (x_0, y_0) and makes angle ϕ\displaystyle \phi with the positive x-axis is given by x=x0+tcos(ϕ)\displaystyle x= x_0+ t cos(\phi) and y=y0+tsin(ϕ)\displaystyle y= y_0+ t sin(\phi) with parameter t.

The points where the line intersects the ellipse are given by x=x0+Lcos(θ)=x0+tcos(ϕ)\displaystyle x= x_0+ L cos(\theta)= x_0+ t cos(\phi) and y=y0+Hcos(θ)=y0+tcos(ϕ)\displaystyle y= y_0+ Hcos(\theta)= y_0+ t cos(\phi). Here, x0\displaystyle x_0, y0\displaystyle y_0, L, H, and ϕ\displaystyle \phi are given constants (in your problem x0=3\displaystyle x_0= 3, y0=4\displaystyle y_0= 4, L= 55, H= 125, and ϕ=30\displaystyle \phi= 30 degrees. That gives two equations to solve for t and θ\displaystyle \theta.

I think you will find it much easier to plot points in computer graphics using "parametric equations" where x and y are given in terms of some third parameter.
 
Last edited by a moderator:
Top