support for various angular units in std.math
Colin Wallace
wallacoloo at gmail.com
Sun Feb 27 17:17:48 PST 2011
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, but I still think it would be nice if there were some
built in functions for dealing with other units than radians. I think
a system that looked like what is used for the Duration struct in
core.time would make things more readable. The code for taking the
sine of a number measured in degrees could look like:
sin!"degrees"(45)
rather than
sin(45*PI/180)
It doesn't make a huge difference to me, but neither does the dur!()
function, yet somebody decided it would be helpful and it made its way
into the standard library. So I figured I would at least share this
idea to see what other people thought of it.
More information about the Digitalmars-d
mailing list