On Thu, Jun 5, 2014 at 7:08 AM, Benoit Jacob <jacob.benoi...@gmail.com>
wrote:

>
>
>
> 2014-06-05 9:08 GMT-04:00 Rik Cabanier <caban...@gmail.com>:
>
>
>>
>>
>> On Thu, Jun 5, 2014 at 5:05 AM, Benoit Jacob <jacob.benoi...@gmail.com>
>> wrote:
>>
>>>
>>>
>>>
>>> 2014-06-05 2:48 GMT-04:00 Rik Cabanier <caban...@gmail.com>:
>>>
>>>
>>>>
>>>>
>>>> On Wed, Jun 4, 2014 at 2:20 PM, Milan Sreckovic <msrecko...@mozilla.com
>>>> > wrote:
>>>>
>>>>> In general, is “this is how it worked with SVGMatrix” one of the
>>>>> design principles?
>>>>>
>>>>> I was hoping this would be the time matrix rotate() method goes to
>>>>> radians, like the canvas rotate, and unlike SVGMatrix version that takes
>>>>> degrees...
>>>>>
>>>>
>>>> "degrees" is easier to understand for authors.
>>>> With the new DOMMatrix constructor, you can specify radians:
>>>>
>>>> var m = new DOMMatrix('rotate(1.75rad)' ;
>>>>
>>>> Not specifying the unit will make it default to degrees (like angles in
>>>> SVG)
>>>>
>>>
>>>
>>> The situation isn't symmetric: radians are inherently simpler to
>>> implement (thus slightly faster), basically because only in radians is it
>>> true that sin(x) ~= x for small x.
>>>
>>> I also doubt that degrees are simpler to understand, and if anything you
>>> might just want to provide a simple name for the constant 2*pi:
>>>
>>> var turn = Math.PI * 2;
>>>
>>> Now, what is easier to understand:
>>>
>>> rotate(turn / 5)
>>>
>>> or
>>>
>>> rotate(72)
>>>
>>
>> The numbers don't lie :-)
>> Just do a google search for "CSS transform rotate". I went over 20 pages
>> of results and they all used "deg".
>>
>
> The other problem is that outside of SVG, other parts of the platform that
> are being proposed to use SVGMatrix were using radians. For example, the
> Canvas 2D context uses radians
>
>
> http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-rotate
>
> Not to mention that JavaScript also uses radians, e.g. in Math.cos().
>

DOMMatrix is designed for interaction with CSS and SVG, both of which use
degrees predominantly.
It's a bit weird that Canvas 2D decided to use radians since it's not
consistent with the platform. Google "canvas rotate radians" to see all the
stackoverflow and blog post on how to use it with degrees.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to