Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / find location of point on ellipse

Author
Message
That1Smart Guy
17
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 17th Mar 2009 04:53
ok ive got an ellipse with radii 200 and 250, i need to find the offset between the center of the ellipse and a point on it. when an angle is made with a line connecting the top of the circle to the middle and a line from the center to the point as legs of an angle, the angle is 45 degrees. ne ideas?
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 17th Mar 2009 05:10
I found a cool way to do this using some trig.

We know that for a circle of radius R, these are true:

X=R*cos(angle)+Cx
Y=R*sin(angle)+Cy

Where the center is at (Cx,Cy).

For an ellipse, this is still true, but you have two radii like so:

X=Rx*cos(angle)+Cx
Y=Ry*cos(angle)+Cy

Where Rx is the radius in the x direction and Ry is the radius in the Y direction.

I am a little confused as to what you are asking for help with, but this is the math that you can use to find any point on an ellipse (I actually wrote a function that would draw one using this math then realized that there was a draw ellipse command )

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
That1Smart Guy
17
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 17th Mar 2009 05:13 Edited at: 17th Mar 2009 05:25
lol, neway where does your "angle" begin/end. is the top of the circle 0 degrees or elsewhere? also did u mistype the ellipse y code, shouldnt it be sin(angle)?

[Edit]
I tried that and heres wat happened, btw i made it id DBPro but i think the code is the same as in DBC



also you will prolly need to edit the locations of the images, i had to type the whole folder list or else an error message occured (maybe you could explain that) luckily i actually organized this code so all the images r together and it shouldnt take long to edit
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 17th Mar 2009 05:15
OOPS yeah my bad, I forget to switch sometimes. The angle will begin at 0 on the coordinate axis, where 0 is the far right side and (should) go counter clockwise.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 19th Mar 2009 08:14
I did something like this for a DBC Challenge, it was a spiral program that drew lines from points on the spiral, i had a few functions for it that could be of use, you'll have to find it yourself though sorry i cant paste anthing on here

The Universe has been erased by a mod because it was larger
than 240x80 pixels.

Login to post a reply

Server time is: 2026-07-22 00:40:33
Your offset time is: 2026-07-22 00:40:33