On 28/02/11 1:17 AM, 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, 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.
When you start doing OpenGL properly, degrees don't show up at all. In
fact, I believe all degrees functions are deprecated in the latest
version (could be wrong on this).
Really, you should be doing all the matrix calculations and rotations
yourself. If anything should come out of this, it would be a nice, small
linear algebra library.