mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-22 06:05:33 -06:00
ScatterDraw: constants and functions list are public
git-svn-id: svn://ultimatepp.org/upp/trunk@9357 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
556a577f54
commit
5f47d24331
2 changed files with 8 additions and 4 deletions
|
|
@ -122,13 +122,15 @@ String FourierEquation::GetEquation(int numDigits) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static double degToRad(double deg) {return M_PI/180.;}
|
||||||
|
|
||||||
EvalExpr::EvalExpr() {
|
EvalExpr::EvalExpr() {
|
||||||
noCase = false;
|
noCase = false;
|
||||||
|
|
||||||
constants.Add("PI", M_PI);
|
constants.Add("PI", M_PI);
|
||||||
constants.Add("M_PI", M_PI);
|
constants.Add("M_PI", M_PI);
|
||||||
constants.Add("e", exp(1.0));
|
constants.Add("e", M_E);
|
||||||
|
|
||||||
functions.Add("abs", fabs);
|
functions.Add("abs", fabs);
|
||||||
functions.Add("ceil", ceil);
|
functions.Add("ceil", ceil);
|
||||||
functions.Add("floor", floor);
|
functions.Add("floor", floor);
|
||||||
|
|
@ -142,6 +144,7 @@ EvalExpr::EvalExpr() {
|
||||||
functions.Add("sinh", sinh);
|
functions.Add("sinh", sinh);
|
||||||
functions.Add("cosh", cosh);
|
functions.Add("cosh", cosh);
|
||||||
functions.Add("tanh", tanh);
|
functions.Add("tanh", tanh);
|
||||||
|
functions.Add("degToRad", degToRad);
|
||||||
}
|
}
|
||||||
|
|
||||||
double EvalExpr::Term(CParser& p) {
|
double EvalExpr::Term(CParser& p) {
|
||||||
|
|
|
||||||
|
|
@ -234,6 +234,9 @@ public:
|
||||||
void GetVariable(int id, String &name, double &value) {name = variables.GetKey(id); value = variables[id];}
|
void GetVariable(int id, String &name, double &value) {name = variables.GetKey(id); value = variables[id];}
|
||||||
int GetVariablesCount() {return variables.GetCount();}
|
int GetVariablesCount() {return variables.GetCount();}
|
||||||
|
|
||||||
|
VectorMap<String, double> constants;
|
||||||
|
VectorMap<String, double (*)(double)> functions;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void *Functions_Get(CParser& p);
|
void *Functions_Get(CParser& p);
|
||||||
double Term(CParser& p);
|
double Term(CParser& p);
|
||||||
|
|
@ -245,10 +248,8 @@ private:
|
||||||
String MulStr(CParser& p, int numDigits);
|
String MulStr(CParser& p, int numDigits);
|
||||||
String ExpStr(CParser& p, int numDigits);
|
String ExpStr(CParser& p, int numDigits);
|
||||||
bool noCase;
|
bool noCase;
|
||||||
|
|
||||||
VectorMap<String, double> constants;
|
|
||||||
VectorMap<String, double> variables;
|
VectorMap<String, double> variables;
|
||||||
VectorMap<String, double (*)(double)> functions;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class UserEquation : public ExplicitEquation {
|
class UserEquation : public ExplicitEquation {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue