mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-peak.git
synced 2025-06-12 02:45:59 +00:00
Added ellipsoid fit function
This commit is contained in:
parent
ff12f10559
commit
8f28b31f26
24
include/sta/math/linalg/ellipsoid.hpp
Normal file
24
include/sta/math/linalg/ellipsoid.hpp
Normal 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
|
@ -61,8 +61,6 @@ namespace sta
|
|||||||
Quaternion normalized();
|
Quaternion normalized();
|
||||||
|
|
||||||
Quaternion conjugate();
|
Quaternion conjugate();
|
||||||
|
|
||||||
matrix toRotationMatrix();
|
|
||||||
public:
|
public:
|
||||||
float x, y, z, w;
|
float x, y, z, w;
|
||||||
};
|
};
|
||||||
|
@ -11,7 +11,7 @@ namespace sta
|
|||||||
{
|
{
|
||||||
namespace math
|
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()},
|
: state_{state.normalized()},
|
||||||
n_{n},
|
n_{n},
|
||||||
alpha_{alpha}
|
alpha_{alpha}
|
||||||
|
25
src/linalg/ellipsoid.cpp
Normal file
25
src/linalg/ellipsoid.cpp
Normal 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
|
||||||
|
|
||||||
|
|
@ -4,10 +4,9 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#ifdef STA_CORE
|
|
||||||
#include <sta/debug/debug.hpp>
|
#include <sta/debug/debug.hpp>
|
||||||
#include <sta/debug/assert.hpp>
|
#include <sta/debug/assert.hpp>
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace sta{
|
namespace sta{
|
||||||
|
|
||||||
|
@ -86,16 +86,6 @@ namespace sta
|
|||||||
return Quaternion(w / n, x / n, y / n, z / n);
|
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)
|
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;
|
float rw = q1.w * q2.w - q1.x * q2.x + q1.y * q2.y + q1.z * q2.z;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user