radians()
Purpose
Change the default units for angles
Description
By default all functions that get or return angles use degrees as the unit (360 degrees in a circle). This function allows you to switch to using radians (2 * PI radians in a circle) and back to degrees
Syntax
radians( enable )
Arguments
enable If 1 (true) then the default unit for angles is swictched to radians otherwise it is degrees
Example
// The 2 for loops are equivalent using different units for angles
clear()
centre = { gWidth() / 2, gHeight() / 2 }
radians( true )
for angle = 0 to 2 * pi step 0.017 loop
col = { random( 101 ) / 100, random( 101 ) / 100, random( 101 ) / 100, 1.0 }
point = { 600 * cos( angle ) + centre.x, 300 * sin( angle ) + centre.y }
line( centre, point, col )
update()
repeat
clear()
sleep( 3 )
radians( 0 )
for angle = 0 to 360 step 1 loop
col = { random( 101 ) / 100, random( 101 ) / 100, random( 101 ) / 100, 1.0 }
point = { 600 * cos( angle ) + centre.x, 300 * sin( angle ) + centre.y }
line( centre, point, col )
update()
repeat
sleep( 3 )
Associated Commands
acos(), asin(), atan(), atan2(), pi(), sin(), sinCos(), tan()