# Visualization Library A lightweight C++ OpenGL middleware for 2D/3D graphics | [Home] [Tutorials] [All Classes] [Grouped Classes]

# vl::quat Class Reference

The quat class implements a quaternion using vl::Real precision. More...

`#include <quat.hpp>`

List of all members.

## Public Member Functions
| quat ()
| quat (const vec4 &v)
| quat (Real x, Real y, Real z, Real w)
| quat (Real degrees, const vec3 &axis)
bool | operator== (const quat &q) const
bool | operator!= (const quat &q) const
bool | operator< (const vec4 &v) const
| lexicographic ordering
quat & | setZero ()
quat & | setNoRotation ()
quat & | fromVectors (const vec4 &from, const vec4 &to)
quat & | fromVectors (const vec3 &from, const vec3 &to)
quat & | fromMatrix (const mat4 &m)
| Creates a quaternion representing the given rotation matrix.
quat & | fromEulerXYZ (Real degX, Real degY, Real degZ)
quat & | fromEulerZYX (Real degZ, Real degY, Real degX)
quat & | fromAxisAngle (Real degrees, const vec3 &axis)
void | toAxisAngle (vec4 &axis, Real &angle) const
| Expects a unit length quaternion.
mat4 | toMatrix () const
| Expects a unit length quaternion.
const vec4 & | xyzw () const
vec4 & | xyzw ()
Real & | x ()
Real & | y ()
Real & | z ()
Real & | w ()
const Real & | x () const
const Real & | y () const
const Real & | z () const
const Real & | w () const
quat | operator* (Real real) const
quat & | operator*= (Real real)
quat | operator/ (Real real) const
quat & | operator/= (Real real)
quat | operator+ (const quat &q) const
quat & | operator+= (const quat &q)
quat | operator- (const quat &q) const
quat & | operator-= (const quat &q)
quat | operator- () const
Real | dot (const quat &q) const
Real | length () const
const quat & | normalize ()
quat | getNormalized () const
Real | lengthSquared () const
quat | conjugate () const
quat | inverse () const
quat | slerp (Real t, const quat &a, const quat &b) const
| Spherical linear interpolation of two quaternions.
quat | squad (Real t, const quat &a, const quat &p, const quat &q, const quat &b) const
| Spherical cubic interpolation of two quaternions.
quat | nlerp (Real t, const quat &a, const quat &b) const
| Normalized spherical interpolation of two quaternions.
## Protected Attributes
vec4 | mXYZW

## Detailed Description

The quat class implements a quaternion using vl::Real precision.

## Constructor & Destructor Documentation

vl::quat::quat | ( |  | ) | `[inline]`

vl::quat::quat | ( | const vec4 & | v | ) | `[inline, explicit]`

vl::quat::quat | ( | Real | x,
|  | Real | y,
|  | Real | z,
|  | Real | w |
| ) |  |  | `[inline, explicit]`

vl::quat::quat | ( | Real | degrees,
|  | const vec3 & | axis |
| ) |  |  | `[inline, explicit]`

## Member Function Documentation

bool vl::quat::operator== | ( | const quat & | q | ) | const`[inline]`

bool vl::quat::operator!= | ( | const quat & | q | ) | const`[inline]`

bool vl::quat::operator< | ( | const vec4 & | v | ) | const`[inline]`

lexicographic ordering

quat& vl::quat::setZero | ( |  | ) | `[inline]`

quat& vl::quat::setNoRotation | ( |  | ) | `[inline]`

quat& vl::quat::fromVectors | ( | const vec4 & | from,
|  | const vec4 & | to |
| ) |  |  | `[inline]`

quat & quat::fromVectors | ( | const vec3 & | from,
|  | const vec3 & | to |
| ) |  |  |

quat & quat::fromMatrix | ( | const mat4 & | m | ) |

Creates a quaternion representing the given rotation matrix.

see also http://www.gamasutra.com/features/19980703/quaternions_01.htm

quat & quat::fromEulerXYZ | ( | Real | degX,
|  | Real | degY,
|  | Real | degZ |
| ) |  |  |

quat & quat::fromEulerZYX | ( | Real | degZ,
|  | Real | degY,
|  | Real | degX |
| ) |  |  |

quat & quat::fromAxisAngle | ( | Real | degrees,
|  | const vec3 & | axis |
| ) |  |  |

void quat::toAxisAngle | ( | vec4 & | axis,
|  | Real & | angle |
| ) |  |  | const

Expects a unit length quaternion.

mat4 quat::toMatrix | ( |  | ) | const

Expects a unit length quaternion.

const vec4& vl::quat::xyzw | ( |  | ) | const`[inline]`

vec4& vl::quat::xyzw | ( |  | ) | `[inline]`

Real& vl::quat::x | ( |  | ) | `[inline]`

Real& vl::quat::y | ( |  | ) | `[inline]`

Real& vl::quat::z | ( |  | ) | `[inline]`

Real& vl::quat::w | ( |  | ) | `[inline]`

const Real& vl::quat::x | ( |  | ) | const`[inline]`

const Real& vl::quat::y | ( |  | ) | const`[inline]`

const Real& vl::quat::z | ( |  | ) | const`[inline]`

const Real& vl::quat::w | ( |  | ) | const`[inline]`

quat vl::quat::operator* | ( | Real | real | ) | const`[inline]`

quat& vl::quat::operator*= | ( | Real | real | ) | `[inline]`

quat vl::quat::operator/ | ( | Real | real | ) | const`[inline]`

quat& vl::quat::operator/= | ( | Real | real | ) | `[inline]`

quat vl::quat::operator+ | ( | const quat & | q | ) | const`[inline]`

quat& vl::quat::operator+= | ( | const quat & | q | ) | `[inline]`

quat vl::quat::operator- | ( | const quat & | q | ) | const`[inline]`

quat& vl::quat::operator-= | ( | const quat & | q | ) | `[inline]`

quat vl::quat::operator- | ( |  | ) | const`[inline]`

Real vl::quat::dot | ( | const quat & | q | ) | const`[inline]`

Real vl::quat::length | ( |  | ) | const`[inline]`

const quat& vl::quat::normalize | ( |  | ) | `[inline]`

quat vl::quat::getNormalized | ( |  | ) | const`[inline]`

Real vl::quat::lengthSquared | ( |  | ) | const`[inline]`

quat vl::quat::conjugate | ( |  | ) | const`[inline]`

quat vl::quat::inverse | ( |  | ) | const`[inline]`

quat quat::slerp | ( | Real | t,
|  | const quat & | a,
|  | const quat & | b |
| ) |  |  | const

Spherical linear interpolation of two quaternions.

See also http://www.gamasutra.com/features/19980703/quaternions_01.htm
Properties: NO commutative, YES torque-minimal, YES constant velocity.

quat vl::quat::squad | ( | Real | t,
|  | const quat & | a,
|  | const quat & | p,
|  | const quat & | q,
|  | const quat & | b |
| ) |  |  | const`[inline]`

Spherical cubic interpolation of two quaternions.

quat vl::quat::nlerp | ( | Real | t,
|  | const quat & | a,
|  | const quat & | b |
| ) |  |  | const`[inline]`

Normalized spherical interpolation of two quaternions.

See also http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/
Properties: YES commutative, YES torque-minimal, NO constant velocity.

## Member Data Documentation

vec4 vl::quat::mXYZW`[protected]`

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

- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/quat.hpp
- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/quat.cpp

Visualization Library v2009.08 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Sun Nov 8 14:29:01 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.