The open source OpenXR runtime

misc: Use pretty printers and remove stale matrix print functions

Use u_pp_matrix_* instead.

+27 -54
-18
src/xrt/auxiliary/math/m_api.h
··· 427 427 math_matrix_3x3_f64_identity(struct xrt_matrix_3x3_f64 *mat); 428 428 429 429 /*! 430 - * Print a 3x3 (col-major) matrix to stdout 431 - * 432 - * @see xrt_matrix_3x3 433 - * @ingroup aux_math 434 - */ 435 - void 436 - math_matrix_3x3_print(const struct xrt_matrix_3x3 *mat); 437 - 438 - /*! 439 430 * Transform a vec3 by a 3x3 matrix 440 431 * 441 432 * @see xrt_matrix_3x3 ··· 518 509 */ 519 510 void 520 511 math_matrix_4x4_identity(struct xrt_matrix_4x4 *result); 521 - 522 - /*! 523 - * Prints a Matrix4x4 (col-major). 524 - * 525 - * @relates xrt_matrix_4x4 526 - * @ingroup aux_math 527 - */ 528 - void 529 - math_matrix_4x4_print(const struct xrt_matrix_4x4 *mat); 530 512 531 513 /*! 532 514 * Multiply Matrix4x4.
-24
src/xrt/auxiliary/math/m_base.cpp
··· 12 12 13 13 #include "math/m_api.h" 14 14 #include "math/m_eigen_interop.hpp" 15 - #include "util/u_logging.h" 16 15 17 16 #include <Eigen/Core> 18 17 #include <Eigen/Geometry> ··· 420 419 } 421 420 422 421 extern "C" void 423 - math_matrix_3x3_print(const struct xrt_matrix_3x3 *mat) 424 - { 425 - const auto &m = mat->v; 426 - U_LOG_RAW("[\n"); 427 - U_LOG_RAW("\t%f, %f, %f,\n", m[0], m[3], m[6]); 428 - U_LOG_RAW("\t%f, %f, %f,\n", m[1], m[4], m[7]); 429 - U_LOG_RAW("\t%f, %f, %f \n", m[2], m[5], m[8]); 430 - U_LOG_RAW("]\n"); 431 - } 432 - 433 - extern "C" void 434 422 math_matrix_3x3_f64_transform_vec3_f64(const struct xrt_matrix_3x3_f64 *left, 435 423 const struct xrt_vec3_f64 *right, 436 424 struct xrt_vec3_f64 *result_out) ··· 523 511 math_matrix_4x4_identity(struct xrt_matrix_4x4 *result) 524 512 { 525 513 map_matrix_4x4(*result) = Eigen::Matrix4f::Identity(); 526 - } 527 - 528 - extern "C" void 529 - math_matrix_4x4_print(const struct xrt_matrix_4x4 *mat) 530 - { 531 - const auto &m = mat->v; 532 - U_LOG_RAW("[\n"); 533 - U_LOG_RAW("\t%f, %f, %f, %f,\n", m[0], m[4], m[8], m[12]); 534 - U_LOG_RAW("\t%f, %f, %f, %f,\n", m[1], m[5], m[9], m[13]); 535 - U_LOG_RAW("\t%f, %f, %f, %f,\n", m[2], m[6], m[10], m[14]); 536 - U_LOG_RAW("\t%f, %f, %f, %f \n", m[3], m[7], m[11], m[15]); 537 - U_LOG_RAW("]\n"); 538 514 } 539 515 540 516 extern "C" void
+27 -12
src/xrt/auxiliary/tracking/t_data_utils.c
··· 12 12 #include "util/u_config_json.h" 13 13 #include "util/u_misc.h" 14 14 #include "util/u_logging.h" 15 + #include "util/u_pretty_print.h" 15 16 16 17 #include <stdio.h> 17 18 #include <assert.h> ··· 357 358 } 358 359 } 359 360 361 + static void 362 + t_inertial_calibration_dump_pp(u_pp_delegate_t dg, struct t_inertial_calibration *c) 363 + { 364 + u_pp(dg, "t_inertial_calibration {"); 365 + u_pp_array2d_f64(dg, &c->transform[0][0], 3, 3, "transform", "\t"); 366 + u_pp_array_f64(dg, c->offset, 3, "offset", "\t"); 367 + u_pp_array_f64(dg, c->bias_std, 3, "bias_std", "\t"); 368 + u_pp_array_f64(dg, c->noise_std, 3, "noise_std", "\t"); 369 + u_pp(dg, "}"); 370 + } 371 + 360 372 void 361 373 t_inertial_calibration_dump(struct t_inertial_calibration *c) 362 374 { 363 - U_LOG_RAW("t_inertial_calibration {"); 364 - dump_mat("transform", c->transform); 365 - dump_vector("offset", c->offset); 366 - dump_vector("bias_std", c->bias_std); 367 - dump_vector("noise_std", c->noise_std); 368 - U_LOG_RAW("}"); 375 + struct u_pp_sink_stack_only sink; 376 + u_pp_delegate_t dg = u_pp_sink_stack_only_init(&sink); 377 + t_inertial_calibration_dump_pp(dg, c); 378 + U_LOG(U_LOGGING_DEBUG, "%s", sink.buffer); 369 379 } 370 380 371 381 void 372 382 t_imu_calibration_dump(struct t_imu_calibration *c) 373 383 { 374 - U_LOG_RAW("t_imu_calibration {"); 375 - U_LOG_RAW("accel = "); 376 - t_inertial_calibration_dump(&c->accel); 377 - U_LOG_RAW("gyro = "); 378 - t_inertial_calibration_dump(&c->gyro); 379 - U_LOG_RAW("}"); 384 + struct u_pp_sink_stack_only sink; 385 + u_pp_delegate_t dg = u_pp_sink_stack_only_init(&sink); 386 + 387 + u_pp(dg, "t_imu_calibration {\n"); 388 + u_pp(dg, "accel = "); 389 + t_inertial_calibration_dump_pp(dg, &c->accel); 390 + u_pp(dg, "gyro = "); 391 + t_inertial_calibration_dump_pp(dg, &c->gyro); 392 + u_pp(dg, "}"); 393 + 394 + U_LOG(U_LOGGING_DEBUG, "%s", sink.buffer); 380 395 }