- Joined
- Jan 13, 2008
- Messages
- 2,303
- Reaction score
- 6
- Points
- 38
- Location
- Atlanta, GA, USA, North America
I'm working on a smal calculator for normalizing vectors, however, the method that I'm using looks a bit sloppy to me.
What I do is given x and y coordinates, I take the arctan of the y over x to get theta which I then take the sin and cosine of to get the normalized y and x values respectively.
When the z value is added, my method breaks apart.
I've tried googling, but I can't seem to find anything that would truly work unless I'm just missing something.
Thanks for any help,
Zat
What I do is given x and y coordinates, I take the arctan of the y over x to get theta which I then take the sin and cosine of to get the normalized y and x values respectively.
Code:
(2,3)
arctaan(2/3)=Θ
cos(Θ)=Xn
sin(Θ)=Yn
I've tried googling, but I can't seem to find anything that would truly work unless I'm just missing something.
Thanks for any help,
Zat