diff options
author | Yuval Peress <peress@chromium.org> | 2019-10-18 13:21:25 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-06 19:44:03 +0000 |
commit | be915c8339500ce81ff2b9944ca5d1ecc6395455 (patch) | |
tree | 943ad743464e7f2b88ab9c8ba15815daf6d8a1e1 /common/vec3.c | |
parent | b1743225b0da0f24a860581e90b999615fbfced5 (diff) | |
download | chrome-ec-be915c8339500ce81ff2b9944ca5d1ecc6395455.tar.gz |
common: Implement newton sphere fit
Add implementation of Newton's method for sphere fitting.
BUG=b:137758297,chromium:1023858
TEST=Added new unit tests
BRANCH=None
Change-Id: Ic78ec4f8a8c2f57ddfa1d5220861bf5c06981ad8
Signed-off-by: Yuval Peress <peress@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1869730
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'common/vec3.c')
-rw-r--r-- | common/vec3.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/common/vec3.c b/common/vec3.c index 29dc22f922..dadf7715ff 100644 --- a/common/vec3.c +++ b/common/vec3.c @@ -9,6 +9,15 @@ #include "vec3.h" #include "util.h" +static fpv3_t zero_initialized_vector = { + FLOAT_TO_FP(0.0f), FLOAT_TO_FP(0.0f), FLOAT_TO_FP(0.0f) +}; + +void fpv3_zero(fpv3_t v) +{ + memcpy(v, zero_initialized_vector, sizeof(fpv3_t)); +} + void fpv3_init(fpv3_t v, fp_t x, fp_t y, fp_t z) { v[X] = x; |