support for various angular units in std.math
Don
nospam at nospam.com
Mon Feb 28 00:48:29 PST 2011
Colin Wallace wrote:
> I've been doing a lot of opengl work in D. Opengl deals primarily
> (maybe even completely?) with degrees.
>
> When using trigonometric functions, they all deal with radians. So
> I've been having to do lots of converting. Converting is very
> straightforward,
Actually, it isn't!
assert(sin(360 * PI / 180 ) == 0.0); // fails!
There are supposed to be sinPi(), cosPi(), tanPi() functions, but they
are not yet implemented (they are quite difficult to get right).
You should use:
sinPi(360/180); to get sine in degrees.
More information about the Digitalmars-d
mailing list