diff options
-rw-r--r-- | common/mag_cal.c | 12 | ||||
-rw-r--r-- | common/mat33.c | 2 | ||||
-rw-r--r-- | common/vec3.c | 12 | ||||
-rw-r--r-- | include/mat33.h | 2 | ||||
-rw-r--r-- | include/vec3.h | 10 |
5 files changed, 19 insertions, 19 deletions
diff --git a/common/mag_cal.c b/common/mag_cal.c index dab2b64d96..f9a0710650 100644 --- a/common/mag_cal.c +++ b/common/mag_cal.c @@ -35,7 +35,7 @@ static int moc_eigen_test(struct mag_cal_t *moc) { mat33_t S; - vec3_t eigenvals; + floatv3_t eigenvals; mat33_t eigenvecs; float evmax, evmin, evmag; int eigen_pass; @@ -80,7 +80,7 @@ static int moc_eigen_test(struct mag_cal_t *moc) /* * Kasa sphere fitting with normal equation */ -static int moc_fit(struct mag_cal_t *moc, vec3_t bias, float *radius) +static int moc_fit(struct mag_cal_t *moc, floatv3_t bias, float *radius) { size4_t pivot; vec4_t out; @@ -120,10 +120,10 @@ static int moc_fit(struct mag_cal_t *moc, vec3_t bias, float *radius) * r = sqrt(xc^2 + yc^2 + zc^2 - out[W]) */ - memcpy(bias, out, sizeof(vec3_t)); - vec3_scalar_mul(bias, -0.5f); + memcpy(bias, out, sizeof(floatv3_t)); + floatv3_scalar_mul(bias, -0.5f); - *radius = sqrtf(vec3_dot(bias, bias) - out[W]); + *radius = sqrtf(floatv3_dot(bias, bias) - out[W]); #if 0 CPRINTF("mag cal: bias (%d, %d, %d), R %d uT\n", @@ -197,7 +197,7 @@ int mag_cal_update(struct mag_cal_t *moc, const intv3_t v) /* 3. eigen test */ if (moc_eigen_test(moc)) { - vec3_t bias; + floatv3_t bias; float radius; /* 4. Kasa sphere fitting */ diff --git a/common/mat33.c b/common/mat33.c index 8317ee8a97..17938c0c4f 100644 --- a/common/mat33.c +++ b/common/mat33.c @@ -55,7 +55,7 @@ void mat33_swap_rows(mat33_t A, const size_t i, const size_t j) * The i-th eigenvalue corresponds to the eigenvector in the i-th _row_ of * "eigenvecs". */ -void mat33_get_eigenbasis(mat33_t S, vec3_t e_vals, mat33_t e_vecs) +void mat33_get_eigenbasis(mat33_t S, floatv3_t e_vals, mat33_t e_vecs) { const size_t N = 3; size3_t ind; diff --git a/common/vec3.c b/common/vec3.c index 12c33179c2..4c157467c1 100644 --- a/common/vec3.c +++ b/common/vec3.c @@ -9,25 +9,25 @@ #include "vec3.h" #include "util.h" -void vec3_scalar_mul(vec3_t v, float c) +void floatv3_scalar_mul(floatv3_t v, float c) { v[X] *= c; v[Y] *= c; v[Z] *= c; } -float vec3_dot(const vec3_t v, const vec3_t w) +float floatv3_dot(const floatv3_t v, const floatv3_t w) { return v[X] * w[X] + v[Y] * w[Y] + v[Z] * w[Z]; } -float vec3_norm_squared(const vec3_t v) +float floatv3_norm_squared(const floatv3_t v) { - return vec3_dot(v, v); + return floatv3_dot(v, v); } -float vec3_norm(const vec3_t v) +float floatv3_norm(const floatv3_t v) { - return sqrtf(vec3_norm_squared(v)); + return sqrtf(floatv3_norm_squared(v)); } diff --git a/include/mat33.h b/include/mat33.h index de7debbbc1..75c0d79366 100644 --- a/include/mat33.h +++ b/include/mat33.h @@ -20,7 +20,7 @@ void mat33_scalar_mul(mat33_t A, float c); void mat33_swap_rows(mat33_t A, const size_t i, const size_t j); -void mat33_get_eigenbasis(mat33_t S, vec3_t eigenvals, mat33_t eigenvecs); +void mat33_get_eigenbasis(mat33_t S, floatv3_t eigenvals, mat33_t eigenvecs); size_t mat33_maxind(mat33_t A, size_t k); diff --git a/include/vec3.h b/include/vec3.h index 68ec1a5c72..367956b2a1 100644 --- a/include/vec3.h +++ b/include/vec3.h @@ -7,11 +7,11 @@ #ifndef __CROS_EC_VEC_3_H #define __CROS_EC_VEC_3_H -typedef float vec3_t[3]; +typedef float floatv3_t[3]; -void vec3_scalar_mul(vec3_t v, float c); -float vec3_dot(const vec3_t v, const vec3_t w); -float vec3_norm_squared(const vec3_t v); -float vec3_norm(const vec3_t v); +void floatv3_scalar_mul(floatv3_t v, float c); +float floatv3_dot(const floatv3_t v, const floatv3_t w); +float floatv3_norm_squared(const floatv3_t v); +float floatv3_norm(const floatv3_t v); #endif /* __CROS_EC_VEC_3_H */ |