The open source OpenXR runtime
0
fork

Configure Feed

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

a/tracking: Make t_camera_models usable from C

Remove C++-isms in the t_camera_models.h header and wrap it
in conditional extern "C" markers.

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2188>

authored by

Jan Schmidt and committed by
Marge Bot
ed67c9c9 5098695a

+26 -18
+26 -18
src/xrt/auxiliary/tracking/t_camera_models.h
··· 26 26 27 27 #include <assert.h> 28 28 29 + #ifdef __cplusplus 30 + extern "C" { 31 + #endif 32 + 29 33 /*! 30 34 * Floating point parameters for @ref T_DISTORTION_FISHEYE_KB4 31 35 * @ingroup aux_tracking ··· 64 68 }; 65 69 66 70 67 - const float SQRT_EPSILON = 0.00316; // sqrt(1e-05) 71 + static const float SQRT_EPSILON = 0.00316; // sqrt(1e-05) 68 72 69 73 /* 70 74 * Functions for @ref T_DISTORTION_FISHEYE_KB4 (un)projections ··· 169 173 const float mx = (x - dist->cx) / dist->fx; 170 174 const float my = (y - dist->cy) / dist->fy; 171 175 172 - float theta(0); 173 - float sin_theta(0); 174 - float cos_theta(1); 176 + float theta = 0.0; 177 + float sin_theta = 0.0; 178 + float cos_theta = 1.0; 175 179 float thetad = sqrt(mx * mx + my * my); 176 - float scaling(1); 177 - float d_func_d_theta(0); 180 + float scaling = 1.0; 181 + float d_func_d_theta = 0.0; 178 182 179 183 if (thetad > SQRT_EPSILON) { 180 184 theta = kb4_solve_theta(dist, &thetad, &d_func_d_theta); ··· 228 232 } 229 233 230 234 static inline void 231 - rt8_distort(const t_camera_model_params *params, 232 - const xrt_vec2 *undist, 233 - xrt_vec2 *dist, 234 - xrt_matrix_2x2 *d_dist_d_undist) 235 + rt8_distort(const struct t_camera_model_params *params, 236 + const struct xrt_vec2 *undist, 237 + struct xrt_vec2 *dist, 238 + struct xrt_matrix_2x2 *d_dist_d_undist) 235 239 { 236 - const float &k1 = params->rt8.k1; 237 - const float &k2 = params->rt8.k2; 238 - const float &p1 = params->rt8.p1; 239 - const float &p2 = params->rt8.p2; 240 - const float &k3 = params->rt8.k3; 241 - const float &k4 = params->rt8.k4; 242 - const float &k5 = params->rt8.k5; 243 - const float &k6 = params->rt8.k6; 240 + const float k1 = params->rt8.k1; 241 + const float k2 = params->rt8.k2; 242 + const float p1 = params->rt8.p1; 243 + const float p2 = params->rt8.p2; 244 + const float k3 = params->rt8.k3; 245 + const float k4 = params->rt8.k4; 246 + const float k5 = params->rt8.k5; 247 + const float k6 = params->rt8.k6; 244 248 245 249 const float xp = undist->x; 246 250 const float yp = undist->y; ··· 553 557 554 558 return t_camera_models_project(dist, x, _y, _z, out_x, out_y); 555 559 } 560 + 561 + #ifdef __cplusplus 562 + } 563 + #endif