Game Development Community

Math help, degrees to normals

by Erik Madison · in Technical Issues · 02/08/2005 (12:43 pm) · 2 replies

Minus a nasty looking if/else, is there a proper way to find my info?
I have degrees of 0-360, I need a Point3F normal, with the values being -1, 0 or 1.

In case I'm not clear :)
a degree of 315-45 is (1, 0, 0) Facing generally forward on the x axis.

#1
02/08/2005 (1:03 pm)
I'm not sure exactly what you're asking. But you could use the equations to convert from polar coordinates to cartersian to get what you're looking for.

X= R * cos(Theta)
Y= R * sin(Theta)

Make sure your theta is converted to radians, or your cos/sin functions take degrees. Also, in your case, just use 1 for R. (Or just omit it.)

Hope that helps.
#2
02/08/2005 (1:14 pm)
Thats beautiful, thanks! I tested it just as typed, and it output exactly what I needed. My last Trig course was 30 years ago....