Added ellipsoid fit function

This commit is contained in:
dario 2024-12-14 11:15:48 +01:00
parent ff12f10559
commit 8f28b31f26
6 changed files with 51 additions and 15 deletions

View File

@ -0,0 +1,24 @@
/*
* ellipsoid.hpp
*
* Created on: Dec 11, 2024
* Author: Dario
*/
#ifndef STA_MATH_LINALG_ELLIPSOID_HPP
#define STA_MATH_LINALG_ELLIPSOID_HPP
#include <cstdint>
namespace sta
{
namespace math
{
namespace linalg
{
void ellipsoid_fit(float* xs, float * ys, float* zs, uint16_t count);
} // namespace linalg
} // namespace math
} // namespace sta
#endif // STA_MATH_LINALG_ELLIPSOID_HPP

View File

@ -61,8 +61,6 @@ namespace sta
Quaternion normalized();
Quaternion conjugate();
matrix toRotationMatrix();
public:
float x, y, z, w;
};

View File

@ -11,7 +11,7 @@ namespace sta
{
namespace math
{
MadgwickFilter::MadgwickFilter(Quaternion state, uint32_t n, float alpha)
MadgwickFilter::MadgwickFilter(Quaternion state, Quaternion direction, uint32_t n, float alpha)
: state_{state.normalized()},
n_{n},
alpha_{alpha}

25
src/linalg/ellipsoid.cpp Normal file
View File

@ -0,0 +1,25 @@
/*
* ellipsoid.cpp
*
* Created on: Dec 11, 2024
* Author: Dario
*/
#include <sta/math/linalg/ellipsoid.hpp>
namespace sta
{
namespace math
{
namespace linalg
{
void ellipsoid_fit(float* xs, float * ys, float* zs, uint16_t count)
{
}
} // namespace linalg
} // namespace math
} // namespace sta

View File

@ -4,10 +4,9 @@
#include <cmath>
#include <iostream>
#ifdef STA_CORE
#include <sta/debug/debug.hpp>
#include <sta/debug/assert.hpp>
#endif
namespace sta{

View File

@ -86,16 +86,6 @@ namespace sta
return Quaternion(w / n, x / n, y / n, z / n);
}
Quaternion Quaternion::operator*(const Quaternion& quat)
{
float rw = w * quat.w - x * quat.x + y * quat.y + z * quat.z;
float rx = w * quat.x + x * quat.w + y * quat.z - z * quat.y;
float ry = w * quat.y - x * quat.z + y * quat.w + z * quat.x;
float rz = w * quat.z - x * quat.y - y * quat.x + z * quat.w;
return Quaternion(rw, rx, ry, rz);
}
Quaternion operator*(const Quaternion& q1, const Quaternion& q2)
{
float rw = q1.w * q2.w - q1.x * q2.x + q1.y * q2.y + q1.z * q2.z;