Re: [geometry] DOMMatrix: Why degrees instead of radians for rotation?

The use of degrees as angles is a legacy of the original SVG specifications
(which the DOM Geometry specs are backwards-compatible with).  In
particular, many of the DOMMatrix methods have equivalents in the old
SVGMatrix interface:

The SVG methods used degrees in part to be consistent with the SVG markup.
I don't know all the reasons behind the original decision to use degrees
instead of radians in the markup, but I do know it would have required much
more complicated parsing rules to allow authors to precisely express angles
such as π/4 in radians.

There may also the benefit of reducing the impact of rounding errors in
common cases such as four right-angle rotations always exactly equalling a
full rotation.  But I agree that it is unfortunate when the JavaScript
trigonometry functions all use radians, and authors will often need a
simple conversion function.


On 31 December 2015 at 01:16, /#!/JoePea <> wrote:

> Well, I guess since browser headquarters are in the USA (except for
> Opera)... It might make sense.
> */#!/*JoePea
> On Wed, Dec 30, 2015 at 11:20 PM, /#!/JoePea <> wrote:
>> I'm just curious why the spec uses degrees instead of radians for
>> DOMMatrix rotation methods. Th whole world except for the USA is on the
>> metric system which uses radians. Plus, radians make more sense and can be
>> easily described with all of JavaScript's `Math.*` which also use radians,
>> so it would make sense to use radians in DOMMatrix as well.
>> If someone really wants to use degrees, they can just use:
>> ```js
>> function toDegrees (angle) {
>>   return angle * (180 / Math.PI);
>> }
>> ```
>> */#!/*JoePea

Received on Friday, 1 January 2016 17:09:32 UTC