git-svn-id: svn://db.shs.com.ru/pip@548 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -105,6 +105,7 @@
|
||||
* * clamp(x, a, b) - trim x on range [a, b]
|
||||
* * step(x, s) - 0 if x < s, else 1
|
||||
* * mix(x, a, b) - interpolate between a and b linear for x (a * (1 - x) + b * x)
|
||||
* * round(x) - round
|
||||
*
|
||||
* There are some built-in constans:
|
||||
* * i (imaginary 1)
|
||||
@@ -161,6 +162,7 @@ PIEvaluatorContent::PIEvaluatorContent() {
|
||||
addFunction("step", 2); // (x,s) = x >= s ? 1. : 0. (1 if 'x' >= 's', else 0)
|
||||
addFunction("mix", 3); // (x,a,b) = a*(1.-x) + b*x (interpolate between 'a' and 'b' linear for 'x')
|
||||
addFunction("defined", 1);
|
||||
addFunction("round", 1);
|
||||
clearCustomVariables();
|
||||
//addVariable("n", 0.);
|
||||
//addVariable("x1", 123);
|
||||
@@ -250,6 +252,7 @@ PIEvaluatorTypes::BaseFunctions PIEvaluatorContent::getBaseFunction(const PIStri
|
||||
if (name == "step") return PIEvaluatorTypes::bfStep;
|
||||
if (name == "mix") return PIEvaluatorTypes::bfMix;
|
||||
if (name == "defined") return PIEvaluatorTypes::bfDefined;
|
||||
if (name == "round") return PIEvaluatorTypes::bfRound;
|
||||
return PIEvaluatorTypes::bfUnknown;
|
||||
}
|
||||
|
||||
@@ -1168,6 +1171,9 @@ inline void PIEvaluator::execFunction(const PIEvaluatorTypes::Instruction & ci)
|
||||
case PIEvaluatorTypes::bfRandomn:
|
||||
tmpvars[oi].value = randomn(value(ci.operators[0]).real(), value(ci.operators[1]).real());
|
||||
break;
|
||||
case PIEvaluatorTypes::bfRound:
|
||||
tmpvars[oi].value = piRoundd(value(ci.operators[0]).real());
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user