The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

a/math: Use angle as magnitude of change in m_filter_euro_quat

Previously this was using math_quat_len which was always 1 for
these unit quaternions. This commit assumes math_quat_ln works properly which is
not exactly true at the moment and the returned angle will be twice as large.

+6 -2
+6 -2
src/xrt/auxiliary/math/m_filter_one_euro.c
··· 282 282 283 283 f->prev_dy = exp_smooth_quat(alpha_d, dy, f->prev_dy); 284 284 285 - double dy_mag = math_quat_len(&f->prev_dy); 286 - double alpha = filter_one_euro_compute_alpha(&f->base, dt, dy_mag); 285 + // The magnitud of the smoothed dy (f->prev_dy) is its rotation angle in radians 286 + struct xrt_vec3 smooth_dy_aa; 287 + math_quat_ln(&f->prev_dy, &smooth_dy_aa); 288 + double smooth_dy_mag = m_vec3_len(smooth_dy_aa); 289 + 290 + double alpha = filter_one_euro_compute_alpha(&f->base, dt, smooth_dy_mag); 287 291 288 292 /* Smooth the dy values and use them to calculate the frequency cutoff for the main filter */ 289 293 f->prev_y = exp_smooth_quat(alpha, *in_y, f->prev_y);