summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-10-23 08:16:24 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-10-23 08:16:24 +0200
commited9316744519fadf113f8c8ee280b1c5d6267f1e (patch)
tree34955f9e39ce70ff60a309fbaebedae688459db7
parent2ffbf6801bd11caf3321cc9004460b3e5c035db3 (diff)
uses non-linear scaling factor for translation
Testing suggests that for optimizing numeric solvers, Z value is by far the least idempotent of the three Signed-off-by: Stanislaw Halik <sthalik@misaki.pl>
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
index 4060a8eb..76f6e687 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp
+++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
@@ -26,11 +26,11 @@ FTNoIR_Filter::~FTNoIR_Filter()
void FTNoIR_Filter::loadSettings() {
QSettings settings("opentrack"); // Registry settings (in HK_USER)
- QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString();
+ QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString();
QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
iniFile.beginGroup ( "Accela" );
- zoom_factor = iniFile.value("zoom-slowness", ACCELA_ZOOM_SLOWNESS).toDouble();
+ zoom_factor = iniFile.value("zoom-slowness", ACCELA_ZOOM_SLOWNESS).toDouble();
rotation_alpha = iniFile.value("rotation-alpha", ACCELA_SMOOTHING_ROTATION).toDouble();
translation_alpha = iniFile.value("translation-alpha", ACCELA_SMOOTHING_TRANSLATION).toDouble();
iniFile.endGroup ();
@@ -45,7 +45,7 @@ void FTNoIR_Filter::receiveSettings(double rot, double trans, double zoom_fac)
zoom_factor = zoom_fac;
}
-static double parabola(const double a, const double x)
+static inline double parabola(const double a, const double x)
{
const double a1 = 1./a;
return a1 * x * x;
@@ -69,6 +69,15 @@ void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position,
QMutexLocker foo(&mutex);
+ static const double scaling[] = {
+ 1.5,
+ 1.5,
+ 1,
+ 1,
+ 1,
+ 1
+ };
+
for (int i=0;i<6;i++)
{
const double vec = target_camera_position[i] - current_camera_position[i];
@@ -76,7 +85,7 @@ void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position,
const double x = fabs(vec);
const double a = i >= 3 ? rotation_alpha : translation_alpha;
const double reduction = 1. / std::max(1., 1. + zoom_factor * -last_post_filter_values[TZ] / 1000);
- const double velocity = parabola(a, x) * reduction;
+ const double velocity = parabola(a, x * scaling[i]) * reduction;
const double result = current_camera_position[i] + velocity * sign;
const bool done = sign > 0 ? result >= target_camera_position[i] : result <= target_camera_position[i];
new_camera_position[i] = current_camera_position[i] = done ? target_camera_position[i] : result;