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]
|
* * clamp(x, a, b) - trim x on range [a, b]
|
||||||
* * step(x, s) - 0 if x < s, else 1
|
* * 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)
|
* * 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:
|
* There are some built-in constans:
|
||||||
* * i (imaginary 1)
|
* * 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("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("mix", 3); // (x,a,b) = a*(1.-x) + b*x (interpolate between 'a' and 'b' linear for 'x')
|
||||||
addFunction("defined", 1);
|
addFunction("defined", 1);
|
||||||
|
addFunction("round", 1);
|
||||||
clearCustomVariables();
|
clearCustomVariables();
|
||||||
//addVariable("n", 0.);
|
//addVariable("n", 0.);
|
||||||
//addVariable("x1", 123);
|
//addVariable("x1", 123);
|
||||||
@@ -250,6 +252,7 @@ PIEvaluatorTypes::BaseFunctions PIEvaluatorContent::getBaseFunction(const PIStri
|
|||||||
if (name == "step") return PIEvaluatorTypes::bfStep;
|
if (name == "step") return PIEvaluatorTypes::bfStep;
|
||||||
if (name == "mix") return PIEvaluatorTypes::bfMix;
|
if (name == "mix") return PIEvaluatorTypes::bfMix;
|
||||||
if (name == "defined") return PIEvaluatorTypes::bfDefined;
|
if (name == "defined") return PIEvaluatorTypes::bfDefined;
|
||||||
|
if (name == "round") return PIEvaluatorTypes::bfRound;
|
||||||
return PIEvaluatorTypes::bfUnknown;
|
return PIEvaluatorTypes::bfUnknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1168,6 +1171,9 @@ inline void PIEvaluator::execFunction(const PIEvaluatorTypes::Instruction & ci)
|
|||||||
case PIEvaluatorTypes::bfRandomn:
|
case PIEvaluatorTypes::bfRandomn:
|
||||||
tmpvars[oi].value = randomn(value(ci.operators[0]).real(), value(ci.operators[1]).real());
|
tmpvars[oi].value = randomn(value(ci.operators[0]).real(), value(ci.operators[1]).real());
|
||||||
break;
|
break;
|
||||||
|
case PIEvaluatorTypes::bfRound:
|
||||||
|
tmpvars[oi].value = piRoundd(value(ci.operators[0]).real());
|
||||||
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ namespace PIEvaluatorTypes {
|
|||||||
bfRad, bfDeg, bfJ0, bfJ1, bfJN,
|
bfRad, bfDeg, bfJ0, bfJ1, bfJN,
|
||||||
bfY0, bfY1, bfYN, bfMin, bfMax,
|
bfY0, bfY1, bfYN, bfMin, bfMax,
|
||||||
bfClamp, bfStep, bfMix, bfDefined,
|
bfClamp, bfStep, bfMix, bfDefined,
|
||||||
|
bfRound,
|
||||||
bfCustom = 0xFFFF
|
bfCustom = 0xFFFF
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user