| Trucs et infos: Numerical Recipes for LiveStage |
|
A
|
ABS: ABSOLUTE VALUE. Built-in function. ABS(x)
ATAN: ARC-TANGENT, Inverse tangent.
ATAN(x) =
x-x*x*x/3 + x*x*x*x*x/5 - x*x*x*x*x*x*x/7 + x*x*x*x*x*x*x*x*x/9 - x*x*x*x*x*x*x*x*x*x*x/11
This is an approximation of the standard ARCTAN function and returns an angle in radians (See RAD2DEG). It is only valid for values of x between -1 and 1. If you want a "4 Quadrant ARCTAN function" (also called ARCTAN2),
please download the script.
|
| C |
CART2POL: Cartesian coordinates to polar coordinates.
Download function from:
http://www.mindinst.org/livestage/DistandDirection.hqx
CEIL: CEILING FUNCTION. For positive numbers: ceil(x) = (x + 0.9999) DIV 1
ex: ceil(5.2) = (5.2 + 0.9999) DIV 1 = 6
COS: Cosine Function. Download the script.
|
| D |
DIV: Integer division. Built-in function. a DIV b returns the integer number of times b can divide into a. ex:
5 DIV 2 = 2
DEG2RAD: Converts degrees into radians: DEG2RAD(x) = x*3.141593/180, or x/57.3
|
| E |
|
|
| F |
Floor: Flooring function. For positive numbers, Floor(x) = x DIV 1. Same as Trunc(x).
ex: Floor(5.9) = 5.9 DIV 1 = 5
|
| M |
MAX: Maximum Function. MAX(a,b) = (a+b + ABS(a-b))/2
ex MAX(2,4.5) = (2+4.5 + ABS(2-4.5))/2 = 4.5
MIN: Minimum Function. MIN(a,b) = (a+b - ABS(a-b))/2
ex MAX(2,4.5) = (2+4.5 - ABS(2-4.5))/2 = 2I
MOD: would like to warn people that the MOD function in LiveStage 1 is not really a MOD function. It is actually a REM (Remainder) function.
What's the difference?
Well, x MOD y has the same sign as y while x REM y has the same sign as x.
This is a very important distinction.
a MOD b = ((a MOD b) + b) MOD b
|
| 0 |
Perspective: Download Spinner Script
PI: PI constant: PI = 3.141593 (approximate)
POLAR2CART: Converts polar coodinates to Cartesian coodinates.
Use x =r*COS(angle), y = r*SIN(angle)
Download script for COS and SIN functions.
|
| R |
REM: Remainder function. The built-in MOD function is actually a REM function in LS 1. See MOD.
builtin function in livestage PRO
ROUND: Round to nearest integer. ROUND(x) = ((ABS(x) + 0.5) DIV 1) *
(x/ABS(x))
If you know that x is positive, you can use ROUND(x) = (x + 0.5) DIV 1
If you know that x is negative, you can use ROUND(x) = (x - 0.5) DIV 1
WARNING: You must first check that x is not zero.
ex: ROUND(4.6) = ((ABS(4.6) + 0.5) DIV 1) * (4.6/ABS(4.6)) = 5
ex: ROUND(-4.6) = ((ABS(-4.6) + 0.5) DIV 1) * (-4.6/ABS(-4.6)) = -5
RAD2DEG: Convert from Radians to Degrees: RAD2DEG(x) = x*180/3.141593, or x*57.3
|
| S |
Sign, sgn: Returns the sign of the number(1 or -1). sgn(x) = x/ABS(x)
WARNING: You must first check that x is not zero.
ex: sign(-4) = -4/ABS(-4) = -1
SIN: Sine function: Download script.
SQRT: Square Root function. Download the script.
If you are using the squareroot function to calculate distance
( SQRT(a^2 +b^2) ) you might also want to look at the Angle and Distance Calculating script:
Download script.
|
| T |
TAN: Tangent Function. Download script.
TRUNC: Truncate decimal portion off, leaving only integer portion. TRUNC(x) = x DIV 1
ex: TRUNC(4.7) = 4.7 DIV 1 = 4
|
|
|