MeshLib C++ Docs
Loading...
Searching...
No Matches

#include <MRMesh/MRQuaternion.h>

Public Member Functions

constexpr Quaternion () noexcept=default
constexpr Quaternion (T a, T b, T c, T d) noexcept
constexpr Quaternion (const Vector3< T > &axis, T angle) noexcept
constexpr Quaternion (T real, const Vector3< T > &im) noexcept
constexpr Quaternion (const Matrix3< T > &m)
constexpr Quaternion (const Vector3< T > &from, const Vector3< T > &to) noexcept
 finds shorter arc rotation quaternion from one vector to another
constexpr Vector3< T > im () const noexcept
 returns imaginary part of the quaternion as a vector
constexpr T angle () const noexcept
 returns angle of rotation encoded in this quaternion
constexpr Vector3< T > axis () const noexcept
 returns axis of rotation encoded in this quaternion
constexpr T normSq () const
constexpr T norm () const
constexpr Quaternion operator- () const
 returns quaternion representing the same rotation, using the opposite rotation direction and opposite angle
void normalize ()
 scales this quaternion to make its norm unit
Quaternion normalized () const
constexpr Quaternion conjugate () const noexcept
 computes conjugate quaternion, which for unit quaternions encodes the opposite rotation
constexpr Quaternion inverse () const noexcept
 computes reciprocal quaternion
constexpr Vector3< T > operator() (const Vector3< T > &p) const noexcept
 operator Matrix3< T > () const
 converts this into 3x3 rotation matrix
Quaternionoperator*= (T s)
Quaternionoperator/= (T s)

Static Public Member Functions

static Quaternion lerp (const Quaternion &q0, const Quaternion &q1, T t)
 given t in [0,1], interpolates linearly two quaternions giving in general not-unit quaternion
static Quaternion slerp (Quaternion q0, Quaternion q1, T t)
 given t in [0,1] and two unit quaternions, interpolates them spherically and produces another unit quaternion
static Matrix3< T > slerp (const Matrix3< T > &m0, const Matrix3< T > &m1, T t)
 given t in [0,1] and two rotation matrices, interpolates them spherically and produces another rotation matrix
static AffineXf3< T > slerp (const AffineXf3< T > &xf0, const AffineXf3< T > &xf1, T t, const Vector3< T > &p={})

Public Attributes

a = 1
 real part of the quaternion
b = 0
c = 0
d = 0
 imaginary part: b*i + c*j + d*k

(Note that these are not member symbols.)

template<typename T>
dot (const Quaternion< T > &a, const Quaternion< T > &b)
 dot product
template<typename T>
Quaternion< T > operator* (const Quaternion< T > &q1, const Quaternion< T > &q2)
 Hamilton product.
template<typename T>
const Quaternion< T > * getCanonicalQuaternions () noexcept
template<typename T>
Quaternion< T > getClosestCanonicalQuaternion (const Quaternion< T > &base) noexcept
 returns closest to base canonical quaternion
template<typename T>
Matrix3< T > slerp (const Matrix3< T > &m0, const Matrix3< T > &m1, T t)
 given t in [0,1] and two rotation matrices, interpolates them spherically and produces another rotation matrix
template<typename T>
AffineXf3< T > slerp (const AffineXf3< T > &xf0, const AffineXf3< T > &xf1, T t, const Vector3< T > &p={})
template<typename T>
Matrix3< T > orthonormalized (const Matrix3< T > &m)
 given any matrix, returns a close rotation matrix
template<typename T>
AffineXf3< T > orthonormalized (const AffineXf3< T > &xf, const Vector3< T > &center={})

Detailed Description

template<typename T>
struct MR::Quaternion< T >

Represents a quaternion following the notations from https:/// en.wikipedia.org/wiki/Quaternion


The documentation for this struct was generated from the following file: