mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
misc: Use pretty printers and remove stale matrix print functions
Use u_pp_matrix_* instead.
This commit is contained in:
parent
7d80729358
commit
29aefe2ba8
|
@ -426,15 +426,6 @@ math_matrix_3x3_identity(struct xrt_matrix_3x3 *mat);
|
|||
void
|
||||
math_matrix_3x3_f64_identity(struct xrt_matrix_3x3_f64 *mat);
|
||||
|
||||
/*!
|
||||
* Print a 3x3 (col-major) matrix to stdout
|
||||
*
|
||||
* @see xrt_matrix_3x3
|
||||
* @ingroup aux_math
|
||||
*/
|
||||
void
|
||||
math_matrix_3x3_print(const struct xrt_matrix_3x3 *mat);
|
||||
|
||||
/*!
|
||||
* Transform a vec3 by a 3x3 matrix
|
||||
*
|
||||
|
@ -519,15 +510,6 @@ math_matrix_3x3_rotation_from_isometry(const struct xrt_matrix_4x4 *isometry, st
|
|||
void
|
||||
math_matrix_4x4_identity(struct xrt_matrix_4x4 *result);
|
||||
|
||||
/*!
|
||||
* Prints a Matrix4x4 (col-major).
|
||||
*
|
||||
* @relates xrt_matrix_4x4
|
||||
* @ingroup aux_math
|
||||
*/
|
||||
void
|
||||
math_matrix_4x4_print(const struct xrt_matrix_4x4 *mat);
|
||||
|
||||
/*!
|
||||
* Multiply Matrix4x4.
|
||||
*
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
#include "math/m_api.h"
|
||||
#include "math/m_eigen_interop.hpp"
|
||||
#include "util/u_logging.h"
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/Geometry>
|
||||
|
@ -419,17 +418,6 @@ math_matrix_3x3_f64_identity(struct xrt_matrix_3x3_f64 *mat)
|
|||
map_matrix_3x3_f64(*mat) = Eigen::Matrix3d::Identity();
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
math_matrix_3x3_print(const struct xrt_matrix_3x3 *mat)
|
||||
{
|
||||
const auto &m = mat->v;
|
||||
U_LOG_RAW("[\n");
|
||||
U_LOG_RAW("\t%f, %f, %f,\n", m[0], m[3], m[6]);
|
||||
U_LOG_RAW("\t%f, %f, %f,\n", m[1], m[4], m[7]);
|
||||
U_LOG_RAW("\t%f, %f, %f \n", m[2], m[5], m[8]);
|
||||
U_LOG_RAW("]\n");
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
math_matrix_3x3_f64_transform_vec3_f64(const struct xrt_matrix_3x3_f64 *left,
|
||||
const struct xrt_vec3_f64 *right,
|
||||
|
@ -525,18 +513,6 @@ math_matrix_4x4_identity(struct xrt_matrix_4x4 *result)
|
|||
map_matrix_4x4(*result) = Eigen::Matrix4f::Identity();
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
math_matrix_4x4_print(const struct xrt_matrix_4x4 *mat)
|
||||
{
|
||||
const auto &m = mat->v;
|
||||
U_LOG_RAW("[\n");
|
||||
U_LOG_RAW("\t%f, %f, %f, %f,\n", m[0], m[4], m[8], m[12]);
|
||||
U_LOG_RAW("\t%f, %f, %f, %f,\n", m[1], m[5], m[9], m[13]);
|
||||
U_LOG_RAW("\t%f, %f, %f, %f,\n", m[2], m[6], m[10], m[14]);
|
||||
U_LOG_RAW("\t%f, %f, %f, %f \n", m[3], m[7], m[11], m[15]);
|
||||
U_LOG_RAW("]\n");
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
math_matrix_4x4_multiply(const struct xrt_matrix_4x4 *left,
|
||||
const struct xrt_matrix_4x4 *right,
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "util/u_config_json.h"
|
||||
#include "util/u_misc.h"
|
||||
#include "util/u_logging.h"
|
||||
#include "util/u_pretty_print.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
@ -357,24 +358,38 @@ t_calibration_gui_params_load_or_default(struct t_calibration_params *p)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
t_inertial_calibration_dump_pp(u_pp_delegate_t dg, struct t_inertial_calibration *c)
|
||||
{
|
||||
u_pp(dg, "t_inertial_calibration {");
|
||||
u_pp_array2d_f64(dg, &c->transform[0][0], 3, 3, "transform", "\t");
|
||||
u_pp_array_f64(dg, c->offset, 3, "offset", "\t");
|
||||
u_pp_array_f64(dg, c->bias_std, 3, "bias_std", "\t");
|
||||
u_pp_array_f64(dg, c->noise_std, 3, "noise_std", "\t");
|
||||
u_pp(dg, "}");
|
||||
}
|
||||
|
||||
void
|
||||
t_inertial_calibration_dump(struct t_inertial_calibration *c)
|
||||
{
|
||||
U_LOG_RAW("t_inertial_calibration {");
|
||||
dump_mat("transform", c->transform);
|
||||
dump_vector("offset", c->offset);
|
||||
dump_vector("bias_std", c->bias_std);
|
||||
dump_vector("noise_std", c->noise_std);
|
||||
U_LOG_RAW("}");
|
||||
struct u_pp_sink_stack_only sink;
|
||||
u_pp_delegate_t dg = u_pp_sink_stack_only_init(&sink);
|
||||
t_inertial_calibration_dump_pp(dg, c);
|
||||
U_LOG(U_LOGGING_DEBUG, "%s", sink.buffer);
|
||||
}
|
||||
|
||||
void
|
||||
t_imu_calibration_dump(struct t_imu_calibration *c)
|
||||
{
|
||||
U_LOG_RAW("t_imu_calibration {");
|
||||
U_LOG_RAW("accel = ");
|
||||
t_inertial_calibration_dump(&c->accel);
|
||||
U_LOG_RAW("gyro = ");
|
||||
t_inertial_calibration_dump(&c->gyro);
|
||||
U_LOG_RAW("}");
|
||||
struct u_pp_sink_stack_only sink;
|
||||
u_pp_delegate_t dg = u_pp_sink_stack_only_init(&sink);
|
||||
|
||||
u_pp(dg, "t_imu_calibration {\n");
|
||||
u_pp(dg, "accel = ");
|
||||
t_inertial_calibration_dump_pp(dg, &c->accel);
|
||||
u_pp(dg, "gyro = ");
|
||||
t_inertial_calibration_dump_pp(dg, &c->gyro);
|
||||
u_pp(dg, "}");
|
||||
|
||||
U_LOG(U_LOGGING_DEBUG, "%s", sink.buffer);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue