Sin degree's to radians

BlitzMax Forums/BlitzMax Programming/Sin degree's to radians

DougUK(Posted 2008) [#1]
Sin(54.66*(Pi/180))=0.016649618

How would i convert it to output in radians?

thus Sin(54.66*(Pi/180))=0.81573397


GfK(Posted 2008) [#2]
Multiply the result by 0.0174532925

(which is Pi/180)


Yahfree(Posted 2008) [#3]
doesn't Sin and Cos return radians by default? Judging by math.mod's source code they do.


Yahfree(Posted 2008) [#4]
Edit: double post... wierd


DougUK(Posted 2008) [#5]
GFK: I know thats the answer but it dosn't seem to work


Yan(Posted 2008) [#6]
The *input* is an angle *not* the output...

As BMax expects all angles to be in degrees, you need to convert from radians...

Const RADIANS_TO_DEGREES! = 180.0! / Pi
Const DEGREES_TO_RADIANS! = Pi / 180.0!

Print "Sine of Rad = " + Sin(54.66 * DEGREES_TO_RADIANS!) ' wrong
Print "Sine of Deg = " + Sin((54.66 * DEGREES_TO_RADIANS!) * RADIANS_TO_DEGREES!) ' right, but mad!
Print "Sine of Deg = " + Sin(54.66) ' right

I don't know why you'd want to convert degrees to radians and back again, but still. ;o)


Who was John Galt?(Posted 2008) [#7]
As Yan said. The output of sin represents a ratio of two lengths, so it's unitless. Maybe you are thinking of asin?


DougUK(Posted 2008) [#8]
Thank you very much Yan, just what i was looking for :)


Yahfree(Posted 2008) [#9]
now how do you draw a filled circle ;)


Bremer(Posted 2008) [#10]
now how do you draw a filled circle


DrawOval( x#,y#,width#,height# )