diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-09-13 16:20:25 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-09-13 16:20:25 +0200 |
commit | 463737c1b50246c56a67c35c1116732006348593 (patch) | |
tree | 2bb7d1721f24a06ef1b0fcc264326ff0db9057cf | |
parent | 04c1f89044a6abc7f922cc8981e74872d63a1bff (diff) |
Don't expose filter internal state. Sprinkle some const
-rw-r--r-- | facetracknoir/tracker.cpp | 3 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.cpp | 5 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.h | 3 | ||||
-rw-r--r-- | ftnoir_filter_base/ftnoir_filter_base.h | 2 | ||||
-rw-r--r-- | ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp | 5 | ||||
-rw-r--r-- | ftnoir_filter_ewma2/ftnoir_filter_ewma2.h | 7 |
6 files changed, 11 insertions, 14 deletions
diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index f2b4845f..ff23a3bc 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -56,7 +56,6 @@ static void get_curve(double pos, double& out, THeadPoseDOF& axis) { /** QThread run method @override **/
void Tracker::run() {
- T6DOF current_camera; // Used for filtering
T6DOF target_camera;
T6DOF new_camera;
@@ -135,7 +134,7 @@ void Tracker::run() { if (Libraries->pFilter) {
for (int i = 0; i < 6; i++)
last_post_filter[i] = gameoutput_camera.axes[i];
- Libraries->pFilter->FilterHeadPoseData(current_camera.axes, target_camera.axes, new_camera.axes, last_post_filter);
+ Libraries->pFilter->FilterHeadPoseData(target_camera.axes, new_camera.axes, last_post_filter);
}
else {
new_camera = target_camera;
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index c2cda351..413702b5 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -51,10 +51,9 @@ static double parabola(const double a, const double x) return a1 * x * x;
}
-void FTNoIR_Filter::FilterHeadPoseData(double *current_camera_position,
- double *target_camera_position,
+void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position,
double *new_camera_position,
- double *last_post_filter_values)
+ const double* last_post_filter_values)
{
if (first_run)
{
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index fb860136..c5a74d22 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -45,7 +45,7 @@ class FTNOIR_FILTER_BASE_EXPORT FTNoIR_Filter : public IFilter public:
FTNoIR_Filter();
~FTNoIR_Filter();
- void FilterHeadPoseData(double *current_camera_position, double *target_camera_position, double *new_camera_position, double *last_post_filter_values);
+ void FilterHeadPoseData(const double* target_camera_position, double *new_camera_position, const double* last_post_filter_values);
void Initialize() {
first_run = true;
}
@@ -55,6 +55,7 @@ private: void loadSettings();
bool first_run;
double rotation_alpha, translation_alpha, zoom_factor;
+ double current_camera_position[6];
};
//*******************************************************************************************************
diff --git a/ftnoir_filter_base/ftnoir_filter_base.h b/ftnoir_filter_base/ftnoir_filter_base.h index 9ff286b1..0f73310f 100644 --- a/ftnoir_filter_base/ftnoir_filter_base.h +++ b/ftnoir_filter_base/ftnoir_filter_base.h @@ -26,7 +26,7 @@ struct IFilter
{
virtual ~IFilter() {}
- virtual void FilterHeadPoseData(double *current_camera_position, double *target_camera_position, double *new_camera_position, double *last_post_filter) = 0;
+ virtual void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position, const double *last_post_filter) = 0;
virtual void Initialize() = 0;
};
diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp index 43cfd102..11af77f7 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp @@ -79,10 +79,9 @@ void FTNoIR_Filter::loadSettings() { iniFile.endGroup ();
}
-void FTNoIR_Filter::FilterHeadPoseData(double *current_camera_position,
- double *target_camera_position,
+void FTNoIR_Filter::FilterHeadPoseData(const double *target_camera_position,
double *new_camera_position,
- double *last_post_filter)
+ const double *last_post_filter)
{
double delta;
double new_alpha;
diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h index 18fec8d4..e3a264be 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h @@ -44,10 +44,9 @@ public: ~FTNoIR_Filter();
void Initialize() {}
- void FilterHeadPoseData(double *current_camera_position,
- double *target_camera_position,
+ void FilterHeadPoseData(const double *target_camera_position,
double *new_camera_position,
- double *last_post_filter);
+ const double *last_post_filter);
void receiveSettings(double smin, double smax, double sexpt);
private:
@@ -61,7 +60,7 @@ private: double kMinSmoothing;
double kMaxSmoothing;
double kSmoothingScaleCurve;
-
+ double current_camera_position[6];
QMutex mutex;
};
|