I definitely vote for extending Numeric so I can do:
90.degrees
and get the right thing.
-- Ernie P.
On Sep 16, 2008, at 4:26 PM, Hugh Sasse wrote:
On Tue, 16 Sep 2008, jerry anning wrote:
Reading the manual, I see that several graphic tools, such as arc,
expect
angles in radians, but others (:angle) take degrees. No big deal,
but I
suggest that standardizing on degrees might not be a bad idea. As I
understand it, Hackety-Hack: the Re-enhackening will be based on
Shoes and
telling them to use something like Math::PI / 4 is one of the
fastest ways I
know to scare off youngsters and mathphobes and it is hard to teach
someone
to program when they run away screaming.
For what it is worth, the Alice programming system http://www.alice.org/
decided to solve this particular problem by defining rotations ( using
turn and roll rather than yaw, pitch and roll) in terms of a complete
turn. So you get instructions like "Lunch Lady, turn right (1/4)
turn".
I suppose you could:
class Object
def degrees(x)
x * Math::PI / 180.0
end
def radians(x)
x
end
end
class Numeric
def degrees
self * Math::PI / 180.0
end
def radians
self
end
end
so you could write
degrees(5) + 5.degrees
and similar stuff for turn, turns. Except turn may come up in
strategy games as take a turn.
Anyone ever use Grads, 400 of them to a full circle?
Given the sets of measurements for {angle, temperature, time},
degrees, minutes and seconds are problematic... Only allow
temperature in Kelvin and Celcius which, strictly speaking, are
not in degrees, I understand? That's before we get started on
MoTown artistes...
Hugh