suve

awful: function: get-angle

Available since rev.40 (v.0.5.4).

Declaration

float :get-angle ( float $SIN , float $COS )

Summary

Returns the angle (in radians - range [0, 2*PI]) corresponding to provided sin+cos value pair.

If the arguments provided are outside [-1, +1] range, or an argument is missing, returns -1.

Example

# :get-angle example
!const =PI f3.1415926535
:float-precision i5
 
:write s'Enter angle in degrees: '
 
:set &deg i0
:readln &deg
 
:set &rad (:div (:mul =PI $deg) f180.0)
:writeln s'Angle in radians: ' $rad
 
:set &sin :sin $rad
:set &cos :cos $rad
 
:writeln s'sin: ' $sin
:writeln s'cos: ' $cos
:writeln s'get-angle: ' :get-angle $sin $cos

wikipage modified on 2014/0916/1530