# Angle to 2D Vector ?

This topic is 5080 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi guys, I'm trying to build an angle table that will store normalized 2D vectors. When I do this: rad=AngleToRed(ang); // just PI/180.0 v.x=sin(rad); v.y=cos(rad); ...the zero angle faces North and subsequent angles go clockwise. Is that the way it's supposed to be ? It's confusing because when I use atan2() the zero angle is East (the positive x-axis) and they go counter-clockwise (which seems more natural ro me.) Thanks. I'm using VC++ 6 if that matters.

##### Share on other sites
You'll have to swap cos and sin, and possibly negate the y-coord to use the screen's coordinate system instead of the standard mathematical one.

##### Share on other sites
A vector of unitary lenght can be expressed by its angle a

v[a] = vector(cos(a), sin(a))

where
a is the angle you rotate (1,0) CCW to get v[a]

with this definition

v[0] = vector(cos(0),sin(0)) = vector(1,0) = x

when a increase v rotates CCW

so you need a look up table to store only cosine and sine values.

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633704
• Total Posts
3013460
×