0

# Why rotate Method needs radians?

Hi, I want to know why rotate() method needs radians?

5 Réponses

+ 23

conversion :
degrees/180*Math.PI=radians

+ 11

Because it's designed that way ^^
( radians are more 'natural' in mathematical context: it's essentially a choice from devellopers of Html/css/js specifications )

+ 7

Radians make it easy to relate linear and angular distances (radius length and arc length) because the only unit comes from the radius.
circumference = 2π * r
Assuming 'meters' (or 'pixels'):
- Degrees: There are 360 degrees in a circle. To get part of the circle you first have to determine how many meters 1 degree is, then multiply this by how many degrees you're sweeping to get rid of 'degrees' and get a formula only containing 'meters'.
- Radians: There are 2π rads in a circle. With radians you just divide 2π*r by the rads you're sweeping. Only the radius has a unit so there's no conversion.
Fewer calculations also help clarity and errors.

+ 2

This is one of those methods that should be rewritten so that all you have to do is pass in the rotation that you are looking for. Most people won't really care if it is technically radians instead of degrees because the results are the same, you rotate the element.
personally I would find it easier if all you had to do was pass in 25 to make a 25 degree rotation, and if you need to dive a little deeper into it then yiu would read further into the documentation.

+ 1

Thank you!