A collection of useful math functions for the NXT.
sin(fRadians)
cos(fRadians)
Returns the sine or cosine of the input parameter. The input value is a float value specified in radians.
asin(Sine)
Returns the arc-sine, i.e. the angle (in radians) whose sine value is “Sine”.
acos(Cos)
Returns the arc-cosine, i.e. the angle (in radians) whose cosine value is “Cos”.
atan(Tangent)
Returns the arc-tangent, i.e. the angle (in radians) whose tangent value is “Tangent”.
PI
Constant float variable containing the value of PI.
sinDegrees(degrees)
cosDegrees(degrees)
Returns the sine or cosine of the input parameter. The input value is float value specified in degrees.
radiansToDegrees(radians)
degreesToRadians(degrees)
Converts between degrees and radians. The converted values are normalized – o to 359 for degrees and 0 to 2 * PI for radians.
abs(input)
exp(input)
sgn(input)
sqrt(input)
Performs the appropriate math function on the input variable.
srand(seed)
Sets the seed for the random number generator.
random(range)
Returns an integer value in the range 0 to ‘range’ where ‘range should be a positive integer in the range 0..32767.