Why rotate Method needs radians? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why rotate Method needs radians?

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

17th Apr 2017, 6:11 PM
Aldo Hernandez
Aldo Hernandez - avatar
5 Answers
+ 23
conversion : degrees/180*Math.PI=radians
17th Apr 2017, 6:51 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 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 )
17th Apr 2017, 6:45 PM
visph
visph - avatar
+ 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.
17th Apr 2017, 7:46 PM
Kirk Schafer
Kirk Schafer - avatar
+ 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.
29th Apr 2017, 3:50 PM
wcountiss
wcountiss - avatar
+ 1
Thank you!
17th Apr 2017, 8:57 PM
Aldo Hernandez
Aldo Hernandez - avatar