- From: Amelia Bellamy-Royds <amelia.bellamy.royds@gmail.com>
- Date: Fri, 1 Jan 2016 10:09:02 -0700
- To: "/#!/JoePea" <trusktr@gmail.com>
- Cc: "public-fx@w3.org" <public-fx@w3.org>
- Message-ID: <CAFDDJ7ykTirmEZh72_G92B-r6t4UM3OZgjJ4xzHiGi6odnd6WA@mail.gmail.com>
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: http://www.w3.org/TR/SVG11/coords.html#InterfaceSVGMatrix 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. ~ABR On 31 December 2015 at 01:16, /#!/JoePea <trusktr@gmail.com> 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 <trusktr@gmail.com> 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