Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 18th, 2005, 7:17 PM   #1
TooDice
Newbie
 
Join Date: Jun 2005
Location: UK
Posts: 14
Rep Power: 0 TooDice is on a distinguished road
Question Finding a point on a circle [solved]

I have a problem where I need to find the x,y coordinates of a point on a circle.

Imagine a point at the origin. I need to be able to work out what the coordinates would be if it moved a certain number of units in a given direction in degrees.

For some reason, after spending an hour or so playing around with sine and cosine my head seems to be going in circles. Can anyone help?

Last edited by TooDice; Jun 18th, 2005 at 9:01 PM.
TooDice is offline   Reply With Quote
Old Jun 18th, 2005, 8:19 PM   #2
EverLearning
Hobbyist Programmer
 
EverLearning's Avatar
 
Join Date: May 2005
Location: Indiana
Posts: 130
Rep Power: 4 EverLearning is on a distinguished road
Is the trajectory circular with a certain radius, i.e. is it a unit circle?
If the problem were the other way around, it would have been a piece of cake, you would not have needed this extra information about radius, it would cancel out:
take arctan(y/x) and you have the angle!

EDIT:
Anyway, if the radius (r) is known or figured out somehow, then sin(a) = y/r, cos(a) = x/r; a - is the angle measured from the positive x-axis; so then you can get x and y.
__________________
got math? yumm...

"All men by nature desire to know" -Aristotle, Metaphysics

Last edited by EverLearning; Jun 18th, 2005 at 8:36 PM.
EverLearning is offline   Reply With Quote
Old Jun 18th, 2005, 8:39 PM   #3
TooDice
Newbie
 
Join Date: Jun 2005
Location: UK
Posts: 14
Rep Power: 0 TooDice is on a distinguished road
Yeah. Basically, find the x,y coordinates of a point on a perfect circle that you would meet if you travelled from the origin in a given direction in degrees. The radius is a variable, but if we use a radius of 1 unit for this example I can just work the rest out fine.

I need a function similar to the progam Logo, where you could type:

RIGHT 33
FORWARD 100

The turtle would then move to the correct place. I need to be able to find the x,y coordinates of this point. Accuracy isn't really a problem as I'll round it to an integer anyway, it just needs to look right.

EDIT:
You happened to edit ur post as I replied. I'll rearrange that and see if I can clean up the mess I made earlier...
__________________
If it squeals, don't smoke it.

Last edited by TooDice; Jun 18th, 2005 at 8:41 PM.
TooDice is offline   Reply With Quote
Old Jun 18th, 2005, 8:59 PM   #4
TooDice
Newbie
 
Join Date: Jun 2005
Location: UK
Posts: 14
Rep Power: 0 TooDice is on a distinguished road
It worked a treat!

x = cos(a)*r
y = sin(a)*r
That was all I needed. Thanks!

I can safely go to sleep now without nightmares about A-level mathematics.
__________________
If it squeals, don't smoke it.
TooDice is offline   Reply With Quote
Old Jun 18th, 2005, 9:02 PM   #5
EverLearning
Hobbyist Programmer
 
EverLearning's Avatar
 
Join Date: May 2005
Location: Indiana
Posts: 130
Rep Power: 4 EverLearning is on a distinguished road
What's A-level mathematics?
__________________
got math? yumm...

"All men by nature desire to know" -Aristotle, Metaphysics
EverLearning is offline   Reply With Quote
Old Jun 18th, 2005, 9:08 PM   #6
TooDice
Newbie
 
Join Date: Jun 2005
Location: UK
Posts: 14
Rep Power: 0 TooDice is on a distinguished road
You know those guys who are obsessed with calculating Pi to infinite decimal places or finding prime numbers? It's when one of those guys decides to get into teaching.
__________________
If it squeals, don't smoke it.
TooDice is offline   Reply With Quote
Old Jun 18th, 2005, 9:10 PM   #7
EverLearning
Hobbyist Programmer
 
EverLearning's Avatar
 
Join Date: May 2005
Location: Indiana
Posts: 130
Rep Power: 4 EverLearning is on a distinguished road
I suppose not, that must be a British thing
Well actually I do, one of them is my DiffEqs instructor
__________________
got math? yumm...

"All men by nature desire to know" -Aristotle, Metaphysics
EverLearning is offline   Reply With Quote
Old Jun 18th, 2005, 9:18 PM   #8
TooDice
Newbie
 
Join Date: Jun 2005
Location: UK
Posts: 14
Rep Power: 0 TooDice is on a distinguished road
When I was at school, you did your A-levels at the age of 16-17. It was optional and you had to spend two years at college to do it. Nowadays, kids leave secondary school at 16 with three A-levels already under their belt.

No wonder why I can't get a decent job.
__________________
If it squeals, don't smoke it.
TooDice is offline   Reply With Quote
Old Jun 23rd, 2005, 7:56 AM   #9
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
Quote:
Originally Posted by TooDice
When I was at school, you did your A-levels at the age of 16-17. It was optional and you had to spend two years at college to do it. Nowadays, kids leave secondary school at 16 with three A-levels already under their belt.
Actually we do them later than your generation, leaving at 18. AS (first year) is easier than the old A-Levels, but A2 is far harder, much closer to degree level.
Rory is offline   Reply With Quote
Old Jun 18th, 2005, 9:27 PM   #10
EverLearning
Hobbyist Programmer
 
EverLearning's Avatar
 
Join Date: May 2005
Location: Indiana
Posts: 130
Rep Power: 4 EverLearning is on a distinguished road
In my native country (Russia), everything used to be compulsory, regular exams, everyone on the same page (ah ... the joys of socialism), regular exams. But since couple years ago they are introducing some standardized cr@p . Glad I'm out
__________________
got math? yumm...

"All men by nature desire to know" -Aristotle, Metaphysics
EverLearning is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:50 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC