cgv
|
#include <quaternion.h>
Public Types | |
{\large a) preliminaries} | |
enum | AxisEnum |
enumeration of the three coordinate axes | |
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 Member Functions | |
const_reverse_iterator | rend () const |
reverse iterator pointing to the end of reverse iteration | |
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 &a) |
fill elements of vector with scalar v | |
void | zeros () |
fill the vector with zeros | |
void | ones () |
fill the vector with ones | |
fvec< T, N+1 > | lift () const |
convert to homogeneous version by adding a 1 | |
vec< T > | to_vec () const |
conversion to vector type | |
T & | x () |
first element | |
const T & | x () const |
first element of const vector | |
T & | y () |
second element | |
const T & | y () const |
second element of const vector | |
T & | z () |
third element | |
const T & | z () const |
third element of const vector | |
T & | w () |
fourth element | |
const T & | w () const |
fourth element of const vector | |
T & | operator() (const int i) |
access i'th element | |
const T & | operator() (const int i) const |
access i'th element of const vector | |
operator T* () | |
cast into array. This allows calls like glVertex<N><T>v(p) instead of glVertex<N><T,N>(p.x(),p.y(),....) | |
operator const T * () const | |
cast into const array | |
fvec< T, N > & | operator+= (const T &s) |
in place addition of a scalar s | |
fvec< T, N > & | operator+= (const fvec< S, N > &_v) |
in place vector addition | |
fvec< T, N > & | operator-= (const T &s) |
in place subtraction by scalar s | |
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 T &s) |
in place division by scalar s | |
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 T &s) const |
componentwise addition of scalar | |
fvec< T, N > | operator- (const T &s) const |
componentwise subtraction of scalar | |
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 |
divides vector by scalar s | |
bool | operator== (const fvec< S, N > &v) const |
test for equality | |
bool | operator!= (const fvec< S, N > &v) const |
test for inequality | |
T | length () const |
length of the vector L2-Norm | |
void | abs () |
componentwise absolute values | |
void | ceil () |
ceil componentwise | |
void | floor () |
floor componentwise | |
void | round () |
round componentwise | |
T | sqr_length () const |
square length of vector | |
double | normalize () |
normalize the vector using the L2-Norm and return the length | |
{\large b) construction} | |
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) |
assignement 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 | |
quaternion (const mat_type &matrix) | |
construct quaternion from 3x3 rotation 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 |
{\large c) initialization} | |
void | set (AxisEnum axis, coord_type angle) |
initialize quaternion from coordinate axis and rotation angle | |
void | set (const vec_type &axis, coord_type angle) |
initialize quaternion from axis and rotation angle | |
void | set (const quaternion< T > &quat) |
setter from quaternion | |
void | set (const mat_type &M) |
initialize quaternion from 3x3 rotation matrix | |
void | set (coord_type re, coord_type ix, coord_type iy, coord_type iz) |
initialize quaternion directly | |
void | set (coord_type re, const vec_type &im) |
initialize quaternion from real part and vector | |
{\large d) conversions and application} | |
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 | |
{\large e) operations} | |
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 | |
{\large f) access to members} | |
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 | |
Static Public Member Functions | |
static fvec< T, N > | from_vec (const vec< T > &) |
conversion from vector | |
static cgv::type::uint32_type | size () |
return number of elements | |
implements a quaternion.