Converting MSVC++ from radians to degrees

Started by
11 comments, last by TheBlackJester 22 years, 3 months ago
always use radians, never degrees. If you think you are having precision problems just use some sort of tolerance thing instead of the equality operator. If you switch back and forth you deserve the imprecision. Degrees have no value in math, science, or programming.
Advertisement
Exactly. The formulas for all the trig functions are based on radians. If you want to use the trig functions, you should stay with radians.

I''ve seen some people who will read in an object''s position, calculate the angle from another point, convert that angle to degrees and store it. Later on, they read the angle, convert it back to radians (!!) and use it. I have to wonder what goes on inside their brains...

Alternatively, you can use lookup tables and your own angle units. Duke Nukem 3D, IIRC, had 2048 angle units in a circle.
Also, you''re asking for trouble by testing a float against 0.0f. This:
if (f <= 0.01f)

is a better bet than this:

if (f == 0.0)

This topic is closed to new replies.

Advertisement