MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
Public Member Functions | List of all members
math::Quaternion< T > Class Template Reference

Quaternion class for arbitrary types (WORK IN PROGRESS). More...

#include <quaternion.h>

Collaboration diagram for math::Quaternion< T >:
Collaboration graph
[legend]

Public Member Functions

 Quaternion (T const &v1, T const &v2, T const &v3, T const &v4)
 Constructor that takes all quaternion values.
 
 Quaternion (T const &value)
 Constructor that initializes ALL values.
 
 Quaternion (Vector< T, 3 > const &axis, T const &angle)
 Creates a quaternion from axis and angle.
 
 Quaternion (void)
 Creates a new, uninitialized quaternion.
 
Quaternion< T > & conjugate (void)
 Conjugates self and returns reference to self.
 
Quaternion< T > conjugated (void) const
 Returns a conjugated copy of self.
 
void get_axis_angle (T *axis, T &angle)
 Provides the axis and angle of the quaternion.
 
Quaternion< T > operator* (Quaternion< T > const &rhs) const
 Quaternion with quaternion multiplication.
 
Quaternion< T > & operator*= (Quaternion< T > const &rhs)
 Quaternion self-multiplication.
 
Vector< T, 3 > rotate (Vector< T, 3 > const &v) const
 Rotates a vector using the quaternion.
 
void set (Vector< T, 3 > const &axis, T const &angle)
 Sets the quaternion from axis and angle.
 
void set_from_rotation_matrix (T const *matrix)
 Sets the quaternion from an orthonormal rotation matrix.
 
void to_rotation_matrix (T *matrix) const
 Conversion to a 3x3 rotation matrix.
 
- Public Member Functions inherited from math::Vector< T, 4 >
 Vector (O const *values)
 Ctor taking a pointer from different type to initialize values.
 
 Vector (T const &v1, T const &v2)
 Ctor that initializes the first two elements.
 
 Vector (T const &v1, T const &v2, T const &v3)
 Ctor that initializes the first three elements.
 
 Vector (T const &v1, T const &v2, T const &v3, T const &v4)
 Ctor that initializes the first four elements.
 
 Vector (T const &value)
 Ctor that initializes ALL elements.
 
 Vector (T const *values)
 Ctor taking a pointer to initialize values.
 
 Vector (Vector< O, N > const &other)
 Copy ctor from vector of different type.
 
 Vector (Vector< T, N > const &other)
 Copy ctor from vector of same type.
 
 Vector (Vector< T, N-1 > const &other, T const &v1)
 Ctor that takes a smaller vector and one element.
 
 Vector (void)
 Default ctor.
 
abs_sum (void) const
 Returns the sum of the absolute values of all elements.
 
Vector< T, N > & abs_value (void)
 Component-wise absolute-value on self, returns self.
 
Vector< T, N > abs_valued (void) const
 Returns a component-wise absolute-value copy of self.
 
Vector< T, N > applied_for_each (F functor) const
 Applies a for-each functor to a copy of the vector.
 
Vector< T, N > & apply_for_each (F functor)
 Applies a for-each functor to all values.
 
T * begin (void)
 
T const * begin (void) const
 
Vector< T, N > & copy (T const *values, int num=N)
 Copies values from the given pointer.
 
Vector< T, N > cross (Vector< T, N > const &other) const
 Cross product between this and another vector.
 
Vector< T, N > cw_div (Vector< T, N > const &other) const
 Component-wise division with another vector.
 
Vector< T, N > cw_mult (Vector< T, N > const &other) const
 Component-wise multiplication with another vector.
 
dot (Vector< T, N > const &other) const
 Dot (or scalar) product between self and another vector.
 
T * end (void)
 
T const * end (void) const
 
Vector< T, N > & fill (T const &value)
 Fills all vector elements with the given value.
 
bool is_similar (Vector< T, N > const &other, T const &epsilon) const
 Component-wise similarity using epsilon checks.
 
maximum (void) const
 Returns the largest element in the vector.
 
minimum (void) const
 Returns the smallest element in the vector.
 
Vector< T, N > & negate (void)
 Component-wise negation on self, returns self.
 
Vector< T, N > negated (void) const
 Returns a component-wise negation on copy of self.
 
norm (void) const
 Computes the norm (length) of the vector.
 
Vector< T, N > & normalize (void)
 Normalizes self and returns reference to self.
 
Vector< T, N > normalized (void) const
 Returns a normalized copy of self.
 
bool operator!= (Vector< T, N > const &rhs) const
 Comparison operator.
 
T & operator() (int index)
 Element access operator.
 
T const & operator() (int index) const
 Const element access operator.
 
Vector< T, N > operator* (T const &rhs) const
 Component-wise multiplication with scalar.
 
T * operator* (void)
 Dereference operator to value array.
 
T const * operator* (void) const
 Const dereference operator to value array.
 
Vector< T, N > & operator*= (T const &rhs)
 Component-wise self-multiplication with scalar.
 
Vector< T, N > operator+ (T const &rhs) const
 Component-wise addition with scalar.
 
Vector< T, N > operator+ (Vector< T, N > const &rhs) const
 Addition with other vector.
 
Vector< T, N > & operator+= (T const &rhs)
 Component-wise self-addition with scalar.
 
Vector< T, N > & operator+= (Vector< T, N > const &rhs)
 Self-addition with other vector.
 
Vector< T, N > operator- (T const &rhs) const
 Component-wise substraction with scalar.
 
Vector< T, N > operator- (Vector< T, N > const &rhs) const
 Substraction with other vector.
 
Vector< T, N > operator- (void) const
 Component-wise negation.
 
Vector< T, N > & operator-= (T const &rhs)
 Component-wise self-substraction with scalar.
 
Vector< T, N > & operator-= (Vector< T, N > const &rhs)
 Self-substraction with other vector.
 
Vector< T, N > operator/ (T const &rhs) const
 Component-wise division by scalar.
 
Vector< T, N > & operator/= (T const &rhs)
 Component-wise self-division by scalar.
 
Vector< T, N > & operator= (Vector< O, N > const &rhs)
 Assignment operator from different type.
 
Vector< T, N > & operator= (Vector< T, N > const &rhs)
 Assignment operator.
 
bool operator== (Vector< T, N > const &rhs) const
 Comparison operator.
 
T & operator[] (int index)
 Element access operator.
 
T const & operator[] (int index) const
 Const element access operator.
 
product (void) const
 Returns the product of all elements.
 
Vector< T, N > & sort_asc (void)
 Sorts the elements of the vector into ascending order.
 
Vector< T, N > & sort_desc (void)
 Sorts the elements of the vector into descending order.
 
Vector< T, N > sorted_asc (void) const
 Returns a sorted vector into ascending order.
 
Vector< T, N > sorted_desc (void) const
 Returns a sorted vector into descending order.
 
square_norm (void) const
 Computes the squared norm of the vector (much cheaper).
 
sum (void) const
 Returns the sum of all elements.
 

Additional Inherited Members

- Public Types inherited from math::Vector< T, 4 >
typedef T ValueType
 
- Static Public Attributes inherited from math::Vector< T, 4 >
static int constexpr dim
 
- Protected Attributes inherited from math::Vector< T, 4 >
v [N]
 

Detailed Description

template<class T>
class math::Quaternion< T >

Quaternion class for arbitrary types (WORK IN PROGRESS).

Definition at line 30 of file quaternion.h.

Constructor & Destructor Documentation

◆ Quaternion() [1/4]

template<typename T >
math::Quaternion< T >::Quaternion ( void  )
inline

Creates a new, uninitialized quaternion.

Definition at line 98 of file quaternion.h.

◆ Quaternion() [2/4]

template<typename T >
math::Quaternion< T >::Quaternion ( T const &  value)
inline

Constructor that initializes ALL values.

Definition at line 104 of file quaternion.h.

◆ Quaternion() [3/4]

template<typename T >
math::Quaternion< T >::Quaternion ( T const &  v1,
T const &  v2,
T const &  v3,
T const &  v4 
)
inline

Constructor that takes all quaternion values.

Definition at line 111 of file quaternion.h.

◆ Quaternion() [4/4]

template<typename T >
math::Quaternion< T >::Quaternion ( Vector< T, 3 > const &  axis,
T const &  angle 
)
inline

Creates a quaternion from axis and angle.

Definition at line 121 of file quaternion.h.

Member Function Documentation

◆ conjugate()

template<typename T >
Quaternion< T > & math::Quaternion< T >::conjugate ( void  )
inline

Conjugates self and returns reference to self.

Definition at line 267 of file quaternion.h.

◆ conjugated()

template<typename T >
Quaternion< T > math::Quaternion< T >::conjugated ( void  ) const
inline

Returns a conjugated copy of self.

Definition at line 277 of file quaternion.h.

◆ get_axis_angle()

template<typename T >
void math::Quaternion< T >::get_axis_angle ( T *  axis,
T &  angle 
)

Provides the axis and angle of the quaternion.

Definition at line 182 of file quaternion.h.

◆ operator*()

template<typename T >
Quaternion< T > math::Quaternion< T >::operator* ( Quaternion< T > const &  rhs) const
inline

Quaternion with quaternion multiplication.

Definition at line 244 of file quaternion.h.

◆ operator*=()

template<typename T >
Quaternion< T > & math::Quaternion< T >::operator*= ( Quaternion< T > const &  rhs)
inline

Quaternion self-multiplication.

Definition at line 259 of file quaternion.h.

◆ rotate()

template<typename T >
Vector< T, 3 > math::Quaternion< T >::rotate ( Vector< T, 3 > const &  v) const

Rotates a vector using the quaternion.

Definition at line 230 of file quaternion.h.

◆ set()

template<typename T >
void math::Quaternion< T >::set ( Vector< T, 3 > const &  axis,
T const &  angle 
)
inline

Sets the quaternion from axis and angle.

Definition at line 128 of file quaternion.h.

◆ set_from_rotation_matrix()

template<typename T >
void math::Quaternion< T >::set_from_rotation_matrix ( T const *  matrix)
inline

Sets the quaternion from an orthonormal rotation matrix.

Definition at line 139 of file quaternion.h.

◆ to_rotation_matrix()

template<typename T >
void math::Quaternion< T >::to_rotation_matrix ( T *  matrix) const

Conversion to a 3x3 rotation matrix.

Definition at line 203 of file quaternion.h.


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