[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
7.2 mglFormula class
Class for evaluating of formula specified by the string. This class is defined in #include <mgl/mgl_eval.h>
.
It is the fast variant of formula evaluation. At creation it will be recognized and compiled to tree-like internal code. At evaluation stage only fast calculations are performed. There is no difference between lower or upper case in formulas. If argument value lie outside the range of function definition then function returns NaN. See section Textual formulas.
- Method on mglFormula:
mglFormula (
const char *
str) Parses the formula str and creates formula-tree. Constructor recursively parses the formula and creates a tree-like structure containing functions and operators for fast further evaluating by
Calc()
orCalcD()
functions.
- Method on mglFormula:
float
Calc (float
x,float
y=0
,float
z=0
,float
u=0
) Evaluates the formula for
'x','r'
=x,'y','n'
=y,'z','t'
=z,'a','u'
=u. Error code (if one) can be obtained from functionGetError()
.
- Method on mglFormula:
float
Calc (float
x,float
y,float
z,float
u,float
v,float
w) Evaluates the formula for
'x'
=x,'y'
=y,'z'
=z,'u'
=u,'v'
=v,'w'
=w. Error code (if one) can be obtained from functionGetError()
.
- Method on mglFormula:
float
Calc (float
var['z'-'a'+1]
) Evaluates the formula for variables in array var[’z’-’a’]. Error code (if one) can be obtained from function
GetError()
.
- Method on mglFormula:
float
CalcD (float
var['z'-'a'+1]
,char
diff) Evaluates the formula derivation respect to diff for variables in array var[’z’-’a’]. Error code (if one) can be obtained from function
GetError()
.
- Method on mglFormula:
int
GetError () Returns error code:
0
means no error;ERR_LOG
means error in logarithm or power functions;ERR_ARC
means error in inverse functions (like asin);ERR_SQRT
means error in sqrt function.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |