Skip to main content
gamedev.net
🔒 Locked

Change Coordinates

Started by fathom88 1 reply 600+ views
Original Post
fathom88
fathom88
I'm given data using one coordinate method but need to plot using another one. Given: My data angle >>>>>>>>>>0 >>>>>>>>>>| >>>>>>>>>>| >>>>>>>>>>| 270 ----------------- 90 >>>>>>>>>>| >>>>>>>>>>| >>>>>>>>>>| >>>>>>>>>180 Plot: My desired angle >>>>>>90 >>>>>>| 180 --------- 0 >>>>>>| >>>>>>270 How would I convert a given angle to desired form. For instance, 90 would be 0, 180 would be 270 etc. I can't think of an easy formula. I could do it with a bunch of "if" statements but would like to avoid this. Thanks for any help. [Edited by - fathom88 on October 21, 2008 1:40:25 PM]
nilkn
nilkn
Notice that to transform the top system into the bottom system, you must rotate it clockwise through 90 degrees and then reflect it in the x-axis. If the angle in the top system is a, then the angle in the bottom system is a' = -(a - 90) = 90 - a.

For example:

a = 90 degrees -> a' = 0 degrees
a = 180 degrees -> a' = (90 - 180) degrees = -90 degrees = 270 degrees


Note that the angle a' produced by this formula may not necessarily be in the range [0,360).
fathom88
fathom88
Thanks. I'll code it up and run some numbers.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.