Functions
CelestLab functions have names that begin with the prefix "CL_". Most names have an additional prefix (2 or 3 letters) that indicates the purpose of the function. Some examples are:
There are rules that apply most of the time that are intended to make things easier:
If an argument has an influence on the meaning or type of other arguments, this argument appears first (i.e. left of the other arguments).
Similar sequences of arguments appear always in the same way. Orbital elements are in the order: semi-major axis, eccentricity, inclination..., optional arguments are in the order: er, mu, j2, rotrBody...
Obligatory arguments should not be named in the calling sequences, but optional arguments can be (although it is generally not considered as a good Scilab practice, as an error in the name cannot be detected).
The default values for some optional arguments are given by variables whose names begin with "%CL_" (e.g. %CL_mu, %CL_eqRad...).
If an (optional) argument is omitted and the corresponding variable does not exist, the default value is retrieved internally. If the default value has to be changed, there are two possibilities:
Example:
// omitting optional argument:
kep = CL_oe_car2kep(pos,vel);
// changing default value - method 1:
kep = CL_oe_car2kep(pos,vel,3.98600E+14);
// or: kep = CL_oe_car2kep(pos,vel,mu=3.98600E+14);
// changing default value - method 2:
%CL_mu = 3.98600E+14;
kep = CL_oe_car2kep(pos,vel);
All CelestLab functions should respect the following rules:
Errors are raised if the input parameters are not in the definition range (and obviously if they are not of the correct type, size etc...).
%nan results are returned if the outputs are not computable (whereas input parameters are in the definition range).
Any function receiving %nan values as input should return %nan values as output.
Any function receiving empty arrays as input should return empty arrays as output.
Note:
These are only guidelines. All functions may not follow them (yet). And there can be exceptions anyway.