/home/runner/work/kynema/kynema/kynema/src/math/quaternion_operations.hpp File Reference

Kynema API: /home/runner/work/kynema/kynema/kynema/src/math/quaternion_operations.hpp File Reference
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
quaternion_operations.hpp File Reference
#include <array>
#include <cmath>
#include <numbers>
#include <Eigen/Geometry>
#include <Kokkos_Core.hpp>

Go to the source code of this file.

Namespaces

namespace  kynema
 
namespace  kynema::math
 

Functions

template<typename Quaternion , typename RotationMatrix >
KOKKOS_INLINE_FUNCTION void kynema::math::QuaternionToRotationMatrix (const Quaternion &q, const RotationMatrix &R)
 Converts a 4x1 quaternion to a 3x3 rotation matrix and returns the result.
 
template<typename Quaternion , typename View1 , typename View2 >
KOKKOS_INLINE_FUNCTION void kynema::math::RotateVectorByQuaternion (const Quaternion &q, const View1 &v, const View2 &v_rot)
 Rotates provided vector by provided unit quaternion and returns the result.
 
template<typename Quaternion , typename Matrix >
KOKKOS_INLINE_FUNCTION void kynema::math::QuaternionDerivative (const Quaternion &q, const Matrix &m)
 Computes the derivative of a quaternion and stores the result in a 3x4 matrix.
 
template<typename QuaternionInput , typename QuaternionOutput >
KOKKOS_INLINE_FUNCTION void kynema::math::QuaternionInverse (const QuaternionInput &q_in, const QuaternionOutput &q_out)
 Computes the inverse of a quaternion.
 
template<typename Quaternion1 , typename Quaternion2 , typename QuaternionN >
KOKKOS_INLINE_FUNCTION void kynema::math::QuaternionCompose (const Quaternion1 &q1, const Quaternion2 &q2, QuaternionN &qn)
 Composes (i.e. multiplies) two quaternions and stores the result in a third quaternion.
 
template<typename Vector , typename Quaternion >
KOKKOS_INLINE_FUNCTION void kynema::math::RotationVectorToQuaternion (const Vector &phi, const Quaternion &quaternion)
 Returns a 4-D quaternion from provided 3-D rotation vector, i.e. the exponential map.
 
template<typename Quaternion , typename Vector >
KOKKOS_INLINE_FUNCTION void kynema::math::QuaternionToRotationVector (const Quaternion &quaternion, const Vector &phi)
 Returns a 3-D rotation vector from provided 4-D quaternion, i.e. the logarithmic map.
 
KOKKOS_INLINE_FUNCTION Kokkos::Array< double, 4 > kynema::math::NormalizeQuaternion (const Kokkos::Array< double, 4 > &q)
 Normalizes a quaternion to ensure it is a unit quaternion.
 
std::array< double, 4 > kynema::math::TangentTwistToQuaternion (const std::array< double, 3 > &tangent, const double twist)
 Returns a 4-D quaternion from provided tangent vector and twist (radians) about tangent.
 
bool kynema::math::IsIdentityQuaternion (const std::array< double, 4 > &q, double tolerance=1e-12)
 Checks if a quaternion is approximately the identity quaternion [1, 0, 0, 0].