|
rand ( lib: Math, file: ../src/gs/gslib_math.cpp )
int rand( range=100 )
IN |
int |
range=100 |
generation interval from 0 to range (optional) |
OUT |
int |
random value in given range |
Returns an integer random number in a specified range, form 0 up to #range-1.
If #range parameter is missing a default range of 100 will be used.
C/C++ source code
frand ( lib: Math, file: ../src/gs/gslib_math.cpp )
float frand( range=1.0 )
IN |
float |
range=1.0 |
generation interval from 0 to range (optional) |
OUT |
float |
random value in given range |
Returns a float random number in a specified range, form 0.0 up to almost #range.
If #range parameter is missing a default range of 1.0 will be used.
C/C++ source code
srand ( lib: Math, file: ../src/gs/gslib_math.cpp )
srand( seed=time )
IN |
int |
seed=time |
random generator seed (optional) |
Resets the random numbers generator, with a specified #seed value.
After calling this function with the same seed, the same random pattern will be generated by calls of gs_rand.
By default, if no seed is specified, a value based on the computer's time counter is used, so the random pattern will be different each time.
C/C++ source code
sgn ( lib: Math, file: ../src/gs/gslib_math.cpp )
int|float sgn( n )
IN |
int|float |
n |
number |
OUT |
int|float |
sign -1=negative,0=zero,1=positive |
Returns the sign of the integer or float number n (accepts both types).
Returns -1 if n is negative, 0 if equal to zero and 1 if positive.
C/C++ source code
abs ( lib: Math, file: ../src/gs/gslib_math.cpp )
int|float abs( n )
IN |
int|float |
n |
number |
OUT |
int|float |
absolute value |
Returns the same value if n is positive and -n if it's negative.
The result is always greater or equal to zero.
C/C++ source code
floor ( lib: Math, file: ../src/gs/gslib_math.cpp )
float floor( n )
IN |
float |
n |
number |
OUT |
float |
floor value |
Returns the integer part of n.
C/C++ source code
ceil ( lib: Math, file: ../src/gs/gslib_math.cpp )
float ceil( n )
IN |
float |
n |
number |
OUT |
float |
ceil value |
Returns the integer part n+1
C/C++ source code
round ( lib: Math, file: ../src/gs/gslib_math.cpp )
float round( n )
IN |
float |
n |
number |
OUT |
float |
rounded value |
Returns the closest integer value to the specified number.
If the fractional part of the n is less than 0.5, it will return the floor, otherwise it will return the ceil.
C/C++ source code
trunc ( lib: Math, file: ../src/gs/gslib_math.cpp )
float trunc( n, decimals=5 )
IN |
float |
n |
number |
float |
decimals=5 |
count of decimals to keep (optional) |
OUT |
float |
truncated number |
Will return the same value of n, but only with the specifed number of decimals.
Even if #decimals has a float type, only integer values will make sence for it.
C/C++ source code
exp ( lib: Math, file: ../src/gs/gslib_math.cpp )
float exp( n )
IN |
float |
n |
number |
OUT |
float |
e rised to the power of n |
Returns the result of the exponential function, applied on n.
C/C++ source code
log ( lib: Math, file: ../src/gs/gslib_math.cpp )
float log( n )
IN |
float |
n |
|
OUT |
float |
natural logarithm of n |
Returns the result of the natural logarithm function applied on n.
C/C++ source code
pow ( lib: Math, file: ../src/gs/gslib_math.cpp )
float pow( n, p )
IN |
float |
n |
number |
float |
p |
exponent |
OUT |
float |
n raised to power of p |
Returns the result of n raised to the power of p.
C/C++ source code
sqrt ( lib: Math, file: ../src/gs/gslib_math.cpp )
float sqrt( n )
IN |
float |
n |
number |
OUT |
float |
square root of n |
Returns the square rood of n
C/C++ source code
sin ( lib: Math, file: ../src/gs/gslib_math.cpp )
float sin( a )
IN |
float |
a |
radians |
OUT |
float |
sine of a |
Calculates sine from angle a in radians (~7 exact decimals).
C/C++ source code
cos ( lib: Math, file: ../src/gs/gslib_math.cpp )
float cos( a )
IN |
float |
a |
radians |
OUT |
float |
cosine of a |
Calculates cosine from angle a in radians (~7 exact decimals).
C/C++ source code
tan ( lib: Math, file: ../src/gs/gslib_math.cpp )
float tan( a )
IN |
float |
a |
radians |
OUT |
float |
tangent of a |
Calculates tangent from angle a in radians (~7 exact decimals).
C/C++ source code
asin ( lib: Math, file: ../src/gs/gslib_math.cpp )
float asin( n )
IN |
float |
n |
number |
OUT |
float |
arcsine of n, in radians |
Calculate arcsine from n, returning angle in radians.
C/C++ source code
acos ( lib: Math, file: ../src/gs/gslib_math.cpp )
float acos( n )
IN |
float |
n |
number |
OUT |
float |
arccosine of n, in radians |
Calculate arccosine from n, returning angle in radians.
C/C++ source code
atan ( lib: Math, file: ../src/gs/gslib_math.cpp )
float atan( n )
IN |
float |
n |
number |
OUT |
float |
arctangent of n, in radians |
Calculate arctangent from n, returning angle radians.
C/C++ source code
PI ( lib: Math, file: ../src/gs/gslib_math.cpp )
3.1415926535897932385
Define with the value of PI.
PI2 ( lib: Math, file: ../src/gs/gslib_math.cpp )
6.283185307179586477
Define with the value of 2*PI.
DEG2RAD ( lib: Math, file: ../src/gs/gslib_math.cpp )
PI / 180.0
Multiply this with degrees to convert them into radians.
RAD2DEG ( lib: Math, file: ../src/gs/gslib_math.cpp )
180.0 / PI
Multiply this with radians to convert them into degrees.
|
|