Log in

View Full Version : Maths -> Convert Degrees to X/Y Coordinates



keyboard
03-19-2014, 10:05 PM
Hey all,
I'm having a lot of trouble with a little project I'm working on.
I'd like to choose a compass bearing (0 - 360) and then move an object in that direction (using X and Y coordinates).

For the first quadrant, I just use trig (tan) to calculate it. But in all the other ones I'm having weird issues. (Tan is the best option because you can calculate the gradient but tan is only positive in two quadrants)
Any tips to point me in the right direction?

djr33
03-26-2014, 04:10 AM
I can't quite picture what you have designed (but I have a fairly good idea), so I'll just answer in general terms.

You've got the (relatively) difficult trig part done. Now you just need to figure out the sign. An easy way to deal with this is to divide the circle into quadrants and work from there-- adjust the sign as needed, and subtract in increments of 90 degrees.

Technically you can probably do this without that and still get the right numbers using tan, but I'm not sure.

Remember the Pythagorean theorem as well, which might help for figuring out X and Y.

Basically just do some trial and error until the signs work out, then the rest should fit into place.

jscheuer1
04-15-2014, 01:35 PM
I assume you've tried cotangent, secant?