Jeff Weisberg on Wed, 8 May 2002 02:20:14 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] math help for this graphing program I'm writing to graph the keyring ?


darxus asks:
|
| The axes of the ellipse are paralel to the coordinate axes.
| 
| I know the x,y coordinates of the center of the ellipse. =20
| 
| I know the height and width of the ellipse.
| 
| I know angle A (it can be anything)
| 
| I am trying to find either the length of line B (radius of the ellipse
| at the given angle), or the x,y coordinates of the intersection of line
| B with the edge of the ellipse (from this I can easily calculate the length).


if we call the "width" of the ellipse 'a', and the 'height', 'b'

the basic equation for an ellipse is:

    x^2   y^2
    --- + ---  = 1
    a^2   b^2

transform to polar coordinates
    x = r * cos A
    y = r * sin A

here 'r' is the length of your line 'B'. this is what we need to solve for.


                        a^2 * b^2
    r^2  =  --------------------------------
             a^2 * sin^2(A) + b^2 * cos^2(A)



	--jeff

______________________________________________________________________
Philadelphia Linux Users Group       -      http://www.phillylinux.org
Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce
General Discussion  -  http://lists.phillylinux.org/mail/listinfo/plug