cos()
Purpose
Returns the cosine of the supplied argument.
Description
This is the cosine function which returns the ratio of the side adjacent to an acute angle in a right-angled triangle to the hypotenuse (longest side)
Syntax
cosine = cos( angle )
Arguments
angle The acute angle adjacent to the side of a right-angled triangle.
cosine The ratio of the adjacent side to the hypotenuse.
Example
clear()
centre = { gWidth() / 2, gHeight() / 2 }
for angle = 0 to 360 loop
// Pick random colour
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 )
repeat
update()
// Wait 3 seconds
sleep( 3 )
Associated Commands
acos(), asin(), atan(), atan2(), pi(), radians(), sin(), sinCos(), tan()