From 16bb3e13dd2a7ed8fa3652e313d592dd81c73a07 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 16 Jul 2016 23:32:48 +0200 Subject: tracker/pt: declare floating-point type size in one place We want double precision for POSIT. It's best for the type to be set in ope place without the need to go over everything while switching it back and forth during tests. Machine epsilon for float is very small as per . Also see the absurdly high epsilon of 1e-4 of POSIT that we've had. With floats, making the epsilon lower resulted in change deltas flushing to zero. This typically led to the translation Z value being very unstable in PT. After the epsilon and data type size changes the Z value is stable. --- tracker-pt/ftnoir_tracker_pt_settings.h | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'tracker-pt/ftnoir_tracker_pt_settings.h') diff --git a/tracker-pt/ftnoir_tracker_pt_settings.h b/tracker-pt/ftnoir_tracker_pt_settings.h index e4bfa371..830bf92e 100644 --- a/tracker-pt/ftnoir_tracker_pt_settings.h +++ b/tracker-pt/ftnoir_tracker_pt_settings.h @@ -6,8 +6,26 @@ * copyright notice and this permission notice appear in all copies. */ -#ifndef FTNOIR_TRACKER_PT_SETTINGS_H -#define FTNOIR_TRACKER_PT_SETTINGS_H +#pragma once + +#include +#include + +struct pt_types +{ + using f = double; + + static constexpr f eps = std::numeric_limits::epsilon(); + static constexpr f pi = f(3.14159265358979323846); + + template using vec = cv::Vec; + using vec2 = vec<2>; + using vec3 = vec<3>; + + template using mat = cv::Matx; + using mat33 = mat<3, 3>; + using mat22 = mat<2, 2>; +}; #include "opentrack-compat/options.hpp" using namespace options; @@ -28,9 +46,9 @@ struct settings_pt : opts value clip_ty, clip_tz, clip_by, clip_bz; value active_model_panel, cap_x, cap_y, cap_z; - + value fov; - + value dynamic_pose; value init_phase_timeout; value auto_threshold; @@ -67,5 +85,3 @@ struct settings_pt : opts auto_threshold(b, "automatic-threshold", false) {} }; - -#endif //FTNOIR_TRACKER_PT_SETTINGS_H -- cgit v1.2.3