//
// Calculate the value of the function, given the input 'x'.
// Used to draw the curve and, most importantly, to translate input to output.
// The return-value is also stored internally, so the Widget can show the current value, when the Tracker is running.
//
double FunctionConfig::getValue(double x) {
	int x2 = (int) (x * MEMOIZE_PRECISION);
	int x3 = (int) ceil(x * MEMOIZE_PRECISION);
	WaitForSingleObject(_mutex, INFINITE);
	double first = getValueInternal(x2);
	double second = getValueInternal(x3);

	double t = x - (int) x;
	double ret = first + (second - first) * t;

	lastValueTracked.setX(x);
	lastValueTracked.setY(ret);

	ReleaseMutex(_mutex);
	return ret;
}
Beispiel #2
0
//
// Calculate the value of the function, given the input 'x'.
// Used to draw the curve and, most importantly, to translate input to output.
// The return-value is also stored internally, so the Widget can show the current value, when the Tracker is running.
//
float FunctionConfig::getValue(float x) {
    QMutexLocker foo(&_mutex);
    int x2 = (int) (std::min<float>(std::max<float>(x, -360), 360) * MEMOIZE_PRECISION);
    float ret = getValueInternal(x2);
	lastValueTracked.setX(x);
	lastValueTracked.setY(ret);
	return ret;
}
Beispiel #3
0
 L FSMNode::getValue(std::string path) {
   return getValueInternal(path.begin(), path.end());
 }