#### Archived

This topic is now archived and is closed to further replies.

## Recommended Posts

Craazer    122
Hi, what is the most common radian coordinate system used in programming? Is it like this: radians | degrees 0 = 0 1.57 = 90 3.14 = 180 4.71 = 270 6.28 = 360 I ask this becose I have read many tutorials using radians and etc but there seems to be many difrend ways using them, for example:

// movement is calculated like this:

newx += speed * cos(angle)
newy += speed * sin(angle)
// or like this

newx += speed * sin(angle)
newy += speed * cos(angle)

// and same thing whit atan2 when calculating direction to target:

// this

atan2 (x - des_x , y - des_y)
// or this

atan2 (des_y - y , des_x - x)
// etc...


Or even more twisted math, so thats why I would need to know what is the right way to do these? And by right way I mean the way all pro's does it :-) [edited by - Craazer on March 5, 2003 12:25:12 PM]

##### Share on other sites
Strife    374
That should be newx/y +=, not just =

Also, there''s only one "radian coordinate system", as you put it, namely what you have there. The speed*cos/sin is simply extracting the x and y components respectively of the velocity so that the x and y components of displacement can be modified separately.

Similarly, the atan commands are using the arctangent to get the angle based on the x and y components of a vector drawn to the target.

##### Share on other sites
Craazer    122
quote:
Original post by CmndrM
That should be newx/y +=, not just =

Also, there''s only one "radian coordinate system", as you put it, namely what you have there. The speed*cos/sin is simply extracting the x and y components respectively of the velocity so that the x and y components of displacement can be modified separately.

Similarly, the atan commands are using the arctangent to get the angle based on the x and y components of a vector drawn to the target.

Yes I know and that thing was just a typo.
What I ment is this:
Most commonly used method seems to be that WEST and NORTH are negative, but in some cases for example the SOUHT and WEST are negative coords. You know what Im trying say?