|
cgv
|
implements a quaternion. More...
#include <quaternion.h>
Public Types | |
| enum | AxisEnum { X_AXIS , Y_AXIS , Z_AXIS } |
| enumeration of the three coordinate axes More... | |
| typedef fvec< T, 4 > | base_type |
| base class type | |
| typedef T | coord_type |
| coordinate type | |
| typedef fvec< T, 3 > | vec_type |
| type of 3d axis | |
| typedef fmat< T, 3, 3 > | mat_type |
| type of 3x3 matrix | |
| typedef fmat< T, 4, 4 > | hmat_type |
| type of 4x4 matrix | |
| Public Types inherited from cgv::math::fvec< T, 4 > | |
| enum | |
| compile-time constant indicating the dimensionality of the vector More... | |
| typedef T | value_type |
| typedef T & | reference |
| typedef const T & | const_reference |
| typedef std::size_t | size_type |
| typedef std::ptrdiff_t | difference_type |
| typedef T * | pointer |
| typedef const T * | const_pointer |
| typedef T * | iterator |
| typedef const T * | const_iterator |
| typedef std::reverse_iterator< iterator > | reverse_iterator |
| typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
Public Member Functions | |
| quaternion () | |
| standard constructor initializes to unit quaternion | |
| quaternion (const quaternion< T > &quat) | |
| copy constructor | |
| template<typename S> | |
| quaternion (const quaternion< S > &q) | |
| copy constructor with type conversion | |
| quaternion< T > & | operator= (const quaternion< T > &quat) |
| assignment operator | |
| quaternion (AxisEnum axis, coord_type angle) | |
| construct quaternion from coordinate axis and rotation angle | |
| quaternion (const vec_type &axis, coord_type angle) | |
| construct quaternion from axis and rotation angle | |
| template<class rot_mat_type> | |
| quaternion (const rot_mat_type &matrix) | |
| construct quaternion from 3x3 rotation or rotational part of homogeneous 3x4 / 4x4 matrix | |
| quaternion (coord_type w, coord_type x, coord_type y, coord_type z) | |
| construct quaternion directly | |
| quaternion (coord_type re, const vec_type &im) | |
| construct quaternion from real part and vector | |
| base_type & | vec () |
| const base_type & | vec () const |
| void | set (AxisEnum axis, coord_type angle) |
| set quaternion from coordinate axis and rotation angle | |
| void | set (const vec_type &axis, coord_type angle) |
| set quaternion from axis and rotation angle | |
| void | set (const quaternion< T > &quat) |
| setter from quaternion | |
| template<class rot_mat_type> | |
| void | set (const rot_mat_type &M) |
| set quaternion from 3x3 rotation or rotational part of homogeneous 3x4 / 4x4 matrix | |
| void | set (coord_type re, coord_type ix, coord_type iy, coord_type iz) |
| set quaternion directly | |
| void | set (coord_type re, const vec_type &im) |
| set quaternion from real part and vector | |
| void | put_matrix (mat_type &M) const |
| compute equivalent 3x3 rotation matrix | |
| mat_type | get_matrix () const |
| return equivalent 3x3 rotation matrix | |
| void | put_homogeneous_matrix (hmat_type &M) const |
| compute equivalent homogeneous 4x4 rotation matrix | |
| hmat_type | get_homogeneous_matrix () const |
| return equivalent 4x4 rotation matrix | |
| void | set_normal (const vec_type &n) |
| initialize quaternion from normal vector | |
| void | put_normal (coord_type *n) |
| extract normal vector | |
| void | put_image (const vec_type &preimage, vec_type &image) const |
| rotate preimage according to quaternion into image | |
| void | rotate (vec_type &v) const |
| rotate vector according to quaternion | |
| vec_type | get_rotated (const vec_type &v) const |
| return rotated vector | |
| void | rotate (mat_type &m) const |
| Rotate a frame according to quaternion. | |
| mat_type | get_rotated (const mat_type &M) const |
| Rotate source frame s into destination frame d. | |
| void | put_preimage (const vec_type &image, vec_type &preimage) const |
| rotate image according to quaternion into preimage | |
| void | inverse_rotate (vec_type &image) const |
| rotate vector according to the inverse quaternion | |
| vec_type | apply (const vec_type &v) const |
| rotate vector according to quaternion | |
| quaternion< T > | conj () const |
| return the conjugate | |
| quaternion< T > | negated () const |
| return the negated quaternion | |
| void | negate () |
| negate the quaternion | |
| void | conjugate () |
| compute conjugate | |
| quaternion< T > | inverse () const |
| return the inverse | |
| void | invert () |
| compute inverse | |
| void | affin (const quaternion< T > &p, coord_type t, const quaternion< T > &q) |
| compute affin combination with angular interpolation | |
| void | affin (coord_type s, const quaternion< T > &q) |
| compute affin combination with angular interpolation | |
| quaternion< T > | operator- () const |
| negation operator | |
| quaternion< T > & | operator*= (const quaternion< T > &q) |
| field multiplication | |
| quaternion< T > | operator* (const quaternion< T > &q) const |
| field multiplication | |
| quaternion< T > & | operator*= (const T &s) |
| in place multiplication with s | |
| quaternion< T > | operator* (const T &s) const |
| multiplication with scalar s | |
| coord_type | re () const |
| return real part | |
| coord_type & | re () |
| return reference to real part | |
| void | put_im (vec_type &vector) const |
| put imaginary part | |
| vec_type | im () const |
| return this as vector | |
| coord_type | put_axis (vec_type &v) const |
| put rotation axis and return rotation angle | |
| quaternion< T > | exp () const |
| exponential map | |
| quaternion< T > | log () const |
| logarithmic map | |
| Public Member Functions inherited from cgv::math::fvec< T, 4 > | |
| fvec () | |
| create an uninitialized vector | |
| fvec (const T &x) | |
| create a vector where all N components are initialized to the constant value x | |
| fvec (const T &x, const T &y) | |
| construct and initialize the first two components to the given values | |
| fvec (const T &x, const T &y, const T &z) | |
| construct and initialize the first three components to the given values | |
| fvec (const T &x, const T &y, const T &z, const T &w) | |
| construct and initialize the first four components to the given values | |
| fvec (cgv::type::uint32_type n, const T *a) | |
| create a vector from an array of size n; if n is less than N the remaining N-n components are set to zero | |
| fvec (cgv::type::uint32_type n, const S *a) | |
| create a vector from an array of size n of a different type; if n is less than N the remaining N-n components are set to zero | |
| fvec (const fvec< S, N > &other) | |
| construct by copy from a vector of a different type | |
| fvec (const fvec< S1, N - 1 > &other, S2 s) | |
| construct from a vector of one dimension less plus a scalar | |
| fvec (const fvec< S, N+1 > &other) | |
| construct from vector of one dimension higher by dropping the highest dimension | |
| fvec (const std::array< T, N > &a) | |
| construct from std::array of same size | |
| void | assign (const std::array< T, N > &a) |
| set to the contents of the given std::array with same size | |
| void | set (const T &x, const T &y) |
| set the first two components | |
| void | set (const T &x, const T &y, const T &z) |
| set the first three components | |
| void | set (const T &x, const T &y, const T &z, const T &w) |
| set the first four components | |
| void | fill (const T &x) |
| fill the vector with constant value x | |
| void | zeros () |
| fill the vector with zeros | |
| void | zerosh () |
| fill the vector with zeros except for the last component, which will be set to one | |
| void | ones () |
| fill the vector with ones | |
| fvec< T, N+1 > | lift () const |
| convert to homogeneous version by adding a 1 | |
| fvec< T, N - 1 > | clip () const |
| convert back from homogeneous representation by performing a w-clip | |
| const fvec< T, N - 1 > & | down () const |
| provide const reference to vector where last dimension is dropped | |
| fvec< T, N - 1 > & | down () |
| provide reference to vector where last dimension is dropped | |
| vec< T > | to_vec () const |
| conversion to vector type | |
| T & | x () |
| return first component | |
| const T & | x () const |
| return first component | |
| T & | y () |
| return second component | |
| const T & | y () const |
| return second component | |
| T & | z () |
| return third component | |
| const T & | z () const |
| return third component | |
| T & | w () |
| return fourth component | |
| const T & | w () const |
| return fourth component | |
| T & | operator[] (int i) |
| return a reference to the component at specified index i | |
| const T & | operator[] (int i) const |
| return a reference to the component at specified index i | |
| T & | operator() (int i) |
| return a reference to the component at specified index i | |
| const T & | operator() (int i) const |
| return a reference to the component at specified index i | |
| T * | data () |
| return a pointer to the underlying array serving as component storage | |
| const T * | data () const |
| return a pointer to the underlying array serving as component storage | |
| iterator | begin () |
| return an iterator to the first component of *this | |
| iterator | end () |
| return an iterator past the last component of *this | |
| const_iterator | begin () const |
| return an iterator to the first component of *this | |
| const_iterator | end () const |
| return an iterator past the last component of *this | |
| reverse_iterator | rbegin () |
| return a reverse iterator to the first component of the reversed *this that corresponds to the last component of the non-reversed *this | |
| reverse_iterator | rend () |
| return a reverse iterator past the last component of the reversed *this that corresponds to the component preceding the first component of the non-reversed *this | |
| const_reverse_iterator | rbegin () const |
| return a reverse iterator to the first component of the reversed *this that corresponds to the last component of the non-reversed *this | |
| const_reverse_iterator | rend () const |
| return a reverse iterator past the last component of the reversed *this that corresponds to the component preceding the first component of the non-reversed *this | |
| fvec< T, N > & | operator+= (const T &s) |
| in place addition of a scalar s | |
| fvec< T, N > & | operator-= (const T &s) |
| in place subtraction by scalar s | |
| fvec< T, N > & | operator*= (const T &s) |
| in place multiplication with s | |
| fvec< T, N > & | operator/= (const T &s) |
| in place division by scalar s | |
| fvec< T, N > & | operator+= (const fvec< S, N > &v) |
| in place vector addition | |
| fvec< T, N > & | operator-= (const fvec< S, N > &v) |
| in place vector subtraction | |
| fvec< T, N > & | operator*= (const fvec< S, N > &v) |
| in place componentwise vector multiplication | |
| fvec< T, N > & | operator/= (const fvec< S, N > &v) |
| in place componentwise vector division | |
| fvec< T, N > | operator+ (const fvec< S, N > &v) const |
| vector addition | |
| fvec< T, N > | operator- (const fvec< S, N > &v) const |
| vector subtraction | |
| fvec< T, N > | operator* (const fvec< S, N > &v) const |
| componentwise vector multiplication | |
| fvec< T, N > | operator/ (const fvec< S, N > &v) const |
| componentwise vector division | |
| fvec< T, N > | operator+ (const T &s) const |
| componentwise addition of scalar | |
| fvec< T, N > | operator- (const T &s) const |
| componentwise subtraction of scalar | |
| fvec< T, N > | operator* (const T &s) const |
| multiplication with scalar s | |
| fvec< T, N > | operator/ (const T &s) const |
| divide vector by scalar s | |
| fvec< T, N > | operator- () const |
| negate the vector | |
| bool | operator== (const fvec< S, N > &v) const |
| test for equality | |
| bool | operator!= (const fvec< S, N > &v) const |
| test for unequal | |
| bool | operator< (const fvec< S, N > &v) const |
| define smaller operator based on component comparison with significance increasing from 0 to N-1, such that fvec can be used as keys in maps | |
| T | sqr_length () const |
| square length of vector | |
| T | length () const |
| length of the vector L2-Norm | |
| void | sign () |
| componentwise sign values | |
| void | step (const fvec< T, N > &r) |
| componentwise step function using stored values as edge | |
| void | abs () |
| componentwise absolute values | |
| void | ceil () |
| ceil componentwise | |
| void | floor () |
| floor componentwise | |
| void | round () |
| round componentwise | |
| T | normalize () |
| normalize the vector using the L2-Norm and return the length | |
| T | safe_normalize () |
| normalize the vector using the L2-Norm and return the length; if length is zero the vector remains unchanged | |
Additional Inherited Members | |
| Static Public Member Functions inherited from cgv::math::fvec< T, 4 > | |
| static fvec< T, N > | zeroh () |
| constuct a homogeneous zero-vector (yields same result as calling fvec<T, N-1>(0).lift() but is faster) | |
| static fvec< T, N > | from_vec (const vec< T > &) |
| conversion from vector | |
| static cgv::type::uint32_type | size () |
| return number of components | |
| Protected Attributes inherited from cgv::math::fvec< T, 4 > | |
| T | v [N] |
implements a quaternion.
Definition at line 20 of file quaternion.h.
| typedef fvec<T,4> cgv::math::quaternion< T >::base_type |
base class type
Definition at line 26 of file quaternion.h.
| typedef T cgv::math::quaternion< T >::coord_type |
coordinate type
Definition at line 28 of file quaternion.h.
| typedef fmat<T, 4, 4> cgv::math::quaternion< T >::hmat_type |
type of 4x4 matrix
Definition at line 36 of file quaternion.h.
| typedef fmat<T, 3, 3> cgv::math::quaternion< T >::mat_type |
type of 3x3 matrix
Definition at line 34 of file quaternion.h.
| typedef fvec<T,3> cgv::math::quaternion< T >::vec_type |
type of 3d axis
Definition at line 32 of file quaternion.h.
| enum cgv::math::quaternion::AxisEnum |
enumeration of the three coordinate axes
Definition at line 30 of file quaternion.h.
|
inline |
standard constructor initializes to unit quaternion
Definition at line 42 of file quaternion.h.
Referenced by cgv::math::quaternion< float >::conj(), cgv::math::quaternion< float >::log(), and cgv::math::quaternion< float >::negated().
|
inline |
copy constructor
Definition at line 44 of file quaternion.h.
|
inline |
copy constructor with type conversion
Definition at line 47 of file quaternion.h.
|
inline |
construct quaternion from coordinate axis and rotation angle
Definition at line 54 of file quaternion.h.
|
inline |
construct quaternion from axis and rotation angle
Definition at line 56 of file quaternion.h.
|
inline |
construct quaternion from 3x3 rotation or rotational part of homogeneous 3x4 / 4x4 matrix
Definition at line 59 of file quaternion.h.
|
inline |
construct quaternion directly
Definition at line 61 of file quaternion.h.
|
inline |
construct quaternion from real part and vector
Definition at line 63 of file quaternion.h.
|
inline |
compute affin combination with angular interpolation
Definition at line 244 of file quaternion.h.
Referenced by cgv::math::quaternion< float >::affin().
|
inline |
compute affin combination with angular interpolation
Definition at line 270 of file quaternion.h.
|
inline |
rotate vector according to quaternion
Definition at line 219 of file quaternion.h.
|
inline |
return the conjugate
Definition at line 224 of file quaternion.h.
|
inline |
compute conjugate
Definition at line 230 of file quaternion.h.
Referenced by cgv::math::quaternion< float >::invert(), and cgv::math::quaternion< float >::negate().
|
inline |
exponential map
Definition at line 330 of file quaternion.h.
Referenced by cgv::math::quaternion< float >::exp().
|
inline |
return equivalent 4x4 rotation matrix
Definition at line 169 of file quaternion.h.
|
inline |
return equivalent 3x3 rotation matrix
Definition at line 152 of file quaternion.h.
|
inline |
Rotate source frame s into destination frame d.
Definition at line 209 of file quaternion.h.
|
inline |
return rotated vector
Definition at line 200 of file quaternion.h.
Referenced by cgv::math::pose_transform_point(), and cgv::math::quaternion< float >::rotate().
|
inline |
return this as vector
Definition at line 307 of file quaternion.h.
Referenced by cgv::math::quaternion< float >::conj(), cgv::math::quaternion< float >::exp(), cgv::math::quaternion< float >::log(), cgv::math::quaternion< float >::negated(), cgv::math::quaternion< float >::put_axis(), cgv::math::quaternion< float >::put_image(), and cgv::math::quaternion< float >::put_preimage().
|
inline |
return the inverse
Definition at line 232 of file quaternion.h.
|
inline |
rotate vector according to the inverse quaternion
Definition at line 217 of file quaternion.h.
|
inline |
compute inverse
Definition at line 234 of file quaternion.h.
Referenced by cgv::math::quaternion< float >::inverse().
|
inline |
logarithmic map
Definition at line 338 of file quaternion.h.
|
inline |
negate the quaternion
Definition at line 228 of file quaternion.h.
|
inline |
return the negated quaternion
Definition at line 226 of file quaternion.h.
Referenced by cgv::math::quaternion< float >::operator-().
|
inline |
field multiplication
Definition at line 292 of file quaternion.h.
|
inline |
multiplication with scalar s
Definition at line 296 of file quaternion.h.
|
inline |
field multiplication
Definition at line 274 of file quaternion.h.
|
inline |
in place multiplication with s
Definition at line 294 of file quaternion.h.
|
inline |
negation operator
Definition at line 272 of file quaternion.h.
|
inline |
assignment operator
Definition at line 49 of file quaternion.h.
|
inline |
put rotation axis and return rotation angle
Definition at line 309 of file quaternion.h.
Referenced by cgv::math::quaternion< float >::put_axis().
|
inline |
compute equivalent homogeneous 4x4 rotation matrix
Definition at line 154 of file quaternion.h.
Referenced by cgv::math::quaternion< float >::get_homogeneous_matrix(), and cgv::math::random::uniform_orientation().
|
inline |
put imaginary part
Definition at line 305 of file quaternion.h.
|
inline |
rotate preimage according to quaternion into image
Definition at line 192 of file quaternion.h.
Referenced by cgv::math::quaternion< float >::apply(), cgv::math::quaternion< float >::get_rotated(), and cgv::math::quaternion< float >::rotate().
|
inline |
compute equivalent 3x3 rotation matrix
Definition at line 139 of file quaternion.h.
Referenced by vr_emulated_kit::construct_pos_matrix(), cgv::math::quaternion< float >::get_matrix(), cgv::math::pose_construct(), vr_emulated_kit::query_state_impl(), cgv::gui::vr_calibration::read_calibration(), and cgv::math::random::uniform_orientation().
|
inline |
extract normal vector
Definition at line 185 of file quaternion.h.
|
inline |
rotate image according to quaternion into preimage
Definition at line 211 of file quaternion.h.
Referenced by cgv::math::quaternion< float >::inverse_rotate().
|
inline |
return reference to real part
Definition at line 303 of file quaternion.h.
|
inline |
return real part
Definition at line 301 of file quaternion.h.
Referenced by cgv::math::quaternion< float >::conj(), cgv::math::quaternion< float >::exp(), cgv::math::quaternion< float >::log(), cgv::math::quaternion< float >::negate(), cgv::math::quaternion< float >::negated(), cgv::math::quaternion< float >::put_axis(), cgv::math::quaternion< float >::put_image(), and cgv::math::quaternion< float >::put_preimage().
|
inline |
Rotate a frame according to quaternion.
Definition at line 202 of file quaternion.h.
|
inline |
rotate vector according to quaternion
Definition at line 198 of file quaternion.h.
Referenced by cgv::math::quaternion< float >::get_rotated().
|
inline |
set quaternion from coordinate axis and rotation angle
Definition at line 70 of file quaternion.h.
Referenced by cgv::math::quaternion< float >::affin(), cgv::math::quaternion< float >::operator*=(), cgv::math::quaternion< float >::quaternion(), cgv::math::quaternion< float >::quaternion(), cgv::math::quaternion< float >::quaternion(), cgv::math::quaternion< float >::quaternion(), cgv::math::quaternion< float >::quaternion(), cgv::math::quaternion< float >::set(), cgv::math::quaternion< float >::set(), cgv::math::quaternion< float >::set(), cgv::math::quaternion< float >::set_normal(), and cgv::math::random::uniform_quat_orientation().
|
inline |
setter from quaternion
Definition at line 83 of file quaternion.h.
|
inline |
set quaternion from 3x3 rotation or rotational part of homogeneous 3x4 / 4x4 matrix
Definition at line 86 of file quaternion.h.
|
inline |
set quaternion from axis and rotation angle
Definition at line 77 of file quaternion.h.
|
inline |
set quaternion from real part and vector
Definition at line 131 of file quaternion.h.
|
inline |
set quaternion directly
Definition at line 123 of file quaternion.h.
|
inline |
initialize quaternion from normal vector
Definition at line 171 of file quaternion.h.
|
inline |
Definition at line 64 of file quaternion.h.
|
inline |
Definition at line 65 of file quaternion.h.