mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-peak.git
synced 2025-06-10 18:16:00 +00:00
83 lines
1.6 KiB
C++
83 lines
1.6 KiB
C++
/*
|
|
* quaternion.hpp
|
|
*
|
|
* Created on: Jun 17, 2024
|
|
* Author: Dario
|
|
*/
|
|
|
|
#ifndef STA_PEAK_QUATERNION_HPP
|
|
#define STA_PEAK_QUATERNION_HPP
|
|
|
|
#include <sta/math/linalg/matrix.hpp>
|
|
namespace sta
|
|
{
|
|
namespace math {
|
|
class Quaternion
|
|
{
|
|
public:
|
|
/**
|
|
* @brief Construct a new Quaternion object
|
|
*
|
|
* @param w
|
|
* @param x
|
|
* @param y
|
|
* @param z
|
|
*/
|
|
Quaternion(float w, float x, float y, float z);
|
|
|
|
/**
|
|
* @brief Construct a new Quaternion object
|
|
*
|
|
*/
|
|
Quaternion();
|
|
|
|
/**
|
|
* @brief
|
|
*
|
|
* @param dt
|
|
* @param ox
|
|
* @param oy
|
|
* @param oz
|
|
* @return Quaternion
|
|
*/
|
|
Quaternion integrate(float dt, float ox, float oy, float oz);
|
|
|
|
/**
|
|
* @brief
|
|
*
|
|
* @return Quaternion
|
|
*/
|
|
static Quaternion unit();
|
|
|
|
/**
|
|
* @brief
|
|
*
|
|
* @return float
|
|
*/
|
|
float norm();
|
|
|
|
/**
|
|
* @brief
|
|
*
|
|
* @return Quaternion
|
|
*/
|
|
Quaternion normalized();
|
|
|
|
Quaternion conjugate();
|
|
|
|
matrix toRotationMatrix();
|
|
public:
|
|
float x, y, z, w;
|
|
};
|
|
Quaternion operator+(const Quaternion& q1, const Quaternion& q2);
|
|
Quaternion operator*(const Quaternion& q1, const Quaternion& q2);
|
|
Quaternion operator*(const Quaternion& quat, float scalar);
|
|
Quaternion operator*(float scalar, const Quaternion& quat);
|
|
Quaternion operator*(const Quaternion& quat, double scalar);
|
|
Quaternion operator*(double scalar, const Quaternion& quat);
|
|
Quaternion operator-(const Quaternion& q1, const Quaternion& q2);
|
|
} // namespace math
|
|
} // namespace sta
|
|
|
|
#endif /* STA_PEAK_QUATERNION_HPP */
|