zenilib: Zeni::Quaternion Class Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Zeni::Quaternion Class Reference
Zenilib

A Featureful Quaternion Class. More...

`#include <Quaternion.h>`

## Public Member Functions

| Quaternion (const bool &degenerate_=false)
| Quaternion (const float &time, const Vector3f &space, const bool &degenerate_=false)
| For advanced use only. More...
| Quaternion (const float &yaw, const float &pitch, const float &roll, const bool &degenerate_=false)
| Quaternion (const Quaternion &rhs, const bool &degenerate_=false)
Quaternion | absolute_value () const
Quaternion | adjoint () const
Quaternion | conjugate () const
| Get the spacial conjugation. More...
Quaternion | determinant () const
Quaternion | euclidean_even_product (const Quaternion &rhs) const
| Get the Euclidean even/inner-product. More...
Quaternion | euclidean_odd_product (const Quaternion &rhs) const
| Get the Euclidean odd/outer-product. More...
Quaternion | euclidean_product (const Quaternion &rhs) const
| Get the Euclidean product. More...
Matrix4f | get_matrix () const
| Get the matrix form of the rotation in row-major order. More...
std::pair< Vector3f, float > | get_rotation () const
| Get the rotation in radians left about an axis. More...
Quaternion | grassman_even_product (const Quaternion &rhs) const
| Get the Grassman even/inner-product. More...
Quaternion | grassman_odd_product (const Quaternion &rhs) const
| Get the Grassman odd/outer-product. More...
Quaternion | grassman_product (const Quaternion &rhs) const
| Get the Grassman-product. More...
float | magnitude () const
| Get the magnitude of the vector. More...
float | magnitude2 () const
| Get the 'magnitude squared' of the vector. More...
Quaternion | norm () const
Quaternion & | normalize ()
| Normalize the vector. More...
Quaternion | normalized () const
| Get the normalized vector. More...
Quaternion | operator* (const Quaternion &rhs) const
| Get the grassman_product. More...
Quaternion | operator* (const float &rhs) const
| Get the scalar multiple. More...
Vector3f | operator* (const Vector3f &rhs) const
| Rotate a vector, maintaining constant magnitude. More...
Quaternion | operator*= (const Quaternion &rhs)
| Get the grassman_odd_product. More...
Quaternion & | operator*= (const float &rhs)
| Set equal to the scalar multiple. More...
Quaternion | operator+ (const Quaternion &rhs) const
| Get the sum. More...
Quaternion & | operator+= (const Quaternion &rhs)
| Set equal to the sum. More...
Quaternion | operator- (const Quaternion &rhs) const
| Get the difference. More...
Quaternion | operator- () const
| Get the negation. More...
Quaternion & | operator-= (const Quaternion &rhs)
| Set equal to the difference. More...
Quaternion | operator/ (const float &rhs) const
| Get the scalar... something. More...
Quaternion & | operator/= (const float &rhs)
| Set equal to the scalar something. More...
const float & | operator[] (const int &index) const
| Get 'index'. More...
float & | operator[] (const int &index)
| Get 'index'. More...
Quaternion | reciprocal () const

## Static Public Member Functions

static Quaternion | Axis_Angle (const Vector3f &v, const float &theta)
| Create a Quaternion from an Axis/Angle pair. More...
static Quaternion | Forward_Up (const Vector3f &destination_forward, const Vector3f &destination_up, const Vector3f &default_forward=ZENI_DEFAULT_FORWARD_VECTOR, const Vector3f &default_up=ZENI_DEFAULT_UP_VECTOR)
| Create a Quaternion from a Forward/Up Vector3f pair. More...
static Quaternion | Vector3f_to_Vector3f (const Vector3f &destination, const Vector3f &source)
| Create a Quaternion rotating to one Vector3f from another. More...

## Public Attributes

bool | degenerate
Vector3f | space
float | time

## Detailed Description

A Featureful Quaternion Class.

Quaternion provides functionality for representing "pure" rotations. You can think of a Quaternion as the combination of an axis and an angle.

Author
  bazald

Contact: bazal.nosp@m.d@ze.nosp@m.nipex.nosp@m..com

Definition at line 44 of file Quaternion.h.

## Constructor & Destructor Documentation

Zeni::Quaternion::Quaternion | ( | const bool & | degenerate_ = `false` | ) |

inlineexplicit

Definition at line 34 of file Quaternion.hxx.

Referenced by absolute_value(), Axis_Angle(), conjugate(), determinant(), euclidean_even_product(), euclidean_odd_product(), euclidean_product(), Forward_Up(), grassman_even_product(), grassman_odd_product(), grassman_product(), norm(), normalized(), operator*(), operator+(), operator-(), operator/(), and Vector3f_to_Vector3f().

Zeni::Quaternion::Quaternion | ( | const float & | time,
|  | const Vector3f & | space,
|  | const bool & | degenerate_ = `false`
| ) |  |

For advanced use only.

Definition at line 26 of file Quaternion.cpp.

Zeni::Quaternion::Quaternion | ( | const float & | yaw,
|  | const float & | pitch,
|  | const float & | roll,
|  | const bool & | degenerate_ = `false`
| ) |  |

Definition at line 97 of file Quaternion.cpp.

References cos(), Zeni::Vector3f::i, Zeni::Vector3f::j, Zeni::Vector3f::k, sin(), space, and time.

Zeni::Quaternion::Quaternion | ( | const Quaternion & | rhs,
|  | const bool & | degenerate_ = `false`
| ) |  |

Definition at line 117 of file Quaternion.cpp.

## Member Function Documentation

Quaternion Zeni::Quaternion::absolute_value | ( |  | ) | const

inline

Definition at line 136 of file Quaternion.hxx.

References degenerate, magnitude(), and Quaternion().

Quaternion Zeni::Quaternion::adjoint | ( |  | ) | const

inline

Definition at line 149 of file Quaternion.hxx.

References conjugate(), and norm().

Quaternion Zeni::Quaternion::Axis_Angle | ( | const Vector3f & | v,
|  | const float & | theta
| ) |  |

static

Create a Quaternion from an Axis/Angle pair.

Definition at line 56 of file Quaternion.cpp.

References cos(), Zeni::Vector3f::degenerate, Zeni::Vector3f::normalized(), Quaternion(), sin(), and time.

Referenced by Zeni::Camera::adjust_pitch(), Zeni::Camera::adjust_roll(), Zeni::Camera::adjust_yaw(), Forward_Up(), Zeni::Model::get_position(), Zeni::Camera::turn_left_xy(), and Vector3f_to_Vector3f().

Quaternion Zeni::Quaternion::conjugate | ( |  | ) | const

inline

Get the spacial conjugation.

Definition at line 127 of file Quaternion.hxx.

References degenerate, Quaternion(), space, and time.

Referenced by adjoint(), and reciprocal().

Quaternion Zeni::Quaternion::determinant | ( |  | ) | const

inline

Definition at line 144 of file Quaternion.hxx.

References degenerate, magnitude2(), and Quaternion().

Quaternion Zeni::Quaternion::euclidean_even_product | ( | const Quaternion & | rhs | ) | const

inline

Get the Euclidean even/inner-product.

Definition at line 87 of file Quaternion.hxx.

References degenerate, Quaternion(), space, and time.

Quaternion Zeni::Quaternion::euclidean_odd_product | ( | const Quaternion & | rhs | ) | const

inline

Get the Euclidean odd/outer-product.

Definition at line 91 of file Quaternion.hxx.

References degenerate, Quaternion(), space, and time.

Quaternion Zeni::Quaternion::euclidean_product | ( | const Quaternion & | rhs | ) | const

inline

Get the Euclidean product.

Definition at line 83 of file Quaternion.hxx.

References degenerate, Quaternion(), space, and time.

Quaternion Zeni::Quaternion::Forward_Up | ( | const Vector3f & | destination_forward,
|  | const Vector3f & | destination_up,
|  | const Vector3f & | default_forward = `ZENI_DEFAULT_FORWARD_VECTOR`,
|  | const Vector3f & | default_up = `ZENI_DEFAULT_UP_VECTOR`
| ) |  |

static

Create a Quaternion from a Forward/Up Vector3f pair.

Definition at line 66 of file Quaternion.cpp.

References Zeni::Vector3f::angle_between(), Axis_Angle(), degenerate, INFINTESSIMAL, Zeni::Global::pi, and Quaternion().

Referenced by Zeni::Camera::look_at().

Matrix4f Zeni::Quaternion::get_matrix | ( |  | ) | const

inline

Get the matrix form of the rotation in row-major order.

Definition at line 199 of file Quaternion.hxx.

References Zeni::Vector3f::i, Zeni::Vector3f::j, Zeni::Vector3f::k, space, and time.

Referenced by Zeni::Matrix4f::Rotate().

std::pair< Vector3f, float > Zeni::Quaternion::get_rotation | ( |  | ) | const

inline

Get the rotation in radians left about an axis.

Definition at line 182 of file Quaternion.hxx.

References fabs(), normalized(), space, and time.

Referenced by Zeni::Video::rotate_scene(), and Zeni::Model::set_rotate().

Quaternion Zeni::Quaternion::grassman_even_product | ( | const Quaternion & | rhs | ) | const

inline

Get the Grassman even/inner-product.

Definition at line 75 of file Quaternion.hxx.

References degenerate, Quaternion(), space, and time.

Quaternion Zeni::Quaternion::grassman_odd_product | ( | const Quaternion & | rhs | ) | const

inline

Get the Grassman odd/outer-product.

Definition at line 79 of file Quaternion.hxx.

References degenerate, Quaternion(), and space.

Quaternion Zeni::Quaternion::grassman_product | ( | const Quaternion & | rhs | ) | const

inline

Get the Grassman-product.

Definition at line 71 of file Quaternion.hxx.

References degenerate, Quaternion(), space, and time.

Referenced by operator*(), and operator*=().

float Zeni::Quaternion::magnitude | ( |  | ) | const

inline

Get the magnitude of the vector.

Definition at line 123 of file Quaternion.hxx.

References magnitude2().

Referenced by absolute_value(), normalize(), and normalized().

float Zeni::Quaternion::magnitude2 | ( |  | ) | const

inline

Get the 'magnitude squared' of the vector.

Definition at line 119 of file Quaternion.hxx.

References space, and time.

Referenced by determinant(), magnitude(), and norm().

Quaternion Zeni::Quaternion::norm | ( |  | ) | const

inline

Definition at line 140 of file Quaternion.hxx.

References degenerate, magnitude2(), and Quaternion().

Referenced by adjoint().

Quaternion & Zeni::Quaternion::normalize | ( |  | ) |

Normalize the vector.

Definition at line 124 of file Quaternion.cpp.

References degenerate, INFINTESSIMAL, magnitude(), space, and time.

Quaternion Zeni::Quaternion::normalized | ( |  | ) | const

Get the normalized vector.

Definition at line 140 of file Quaternion.cpp.

References INFINTESSIMAL, magnitude(), Quaternion(), space, and time.

Referenced by get_rotation(), and Vector3f_to_Vector3f().

Quaternion Zeni::Quaternion::operator* | ( | const Quaternion & | rhs | ) | const

inline

Get the grassman_product.

Definition at line 63 of file Quaternion.hxx.

References grassman_product().

Quaternion Zeni::Quaternion::operator* | ( | const float & | rhs | ) | const

inline

Get the scalar multiple.

Definition at line 95 of file Quaternion.hxx.

References degenerate, Quaternion(), space, and time.

Vector3f Zeni::Quaternion::operator* | ( | const Vector3f & | rhs | ) | const

inline

Rotate a vector, maintaining constant magnitude.

Definition at line 153 of file Quaternion.hxx.

References d, degenerate, Zeni::Vector3f::degenerate, Zeni::Vector3f::i, Zeni::Vector3f::j, Zeni::Vector3f::k, space, t2, and time.

Quaternion Zeni::Quaternion::operator*= | ( | const Quaternion & | rhs | ) |

inline

Get the grassman_odd_product.

Definition at line 67 of file Quaternion.hxx.

References grassman_product().

Quaternion & Zeni::Quaternion::operator*= | ( | const float & | rhs | ) |

inline

Set equal to the scalar multiple.

Definition at line 103 of file Quaternion.hxx.

References space, and time.

Quaternion Zeni::Quaternion::operator+ | ( | const Quaternion & | rhs | ) | const

inline

Get the sum.

Definition at line 41 of file Quaternion.hxx.

References degenerate, Quaternion(), space, and time.

Quaternion & Zeni::Quaternion::operator+= | ( | const Quaternion & | rhs | ) |

inline

Set equal to the sum.

Definition at line 49 of file Quaternion.hxx.

References degenerate, space, and time.

Quaternion Zeni::Quaternion::operator- | ( | const Quaternion & | rhs | ) | const

inline

Get the difference.

Definition at line 45 of file Quaternion.hxx.

References degenerate, Quaternion(), space, and time.

Quaternion Zeni::Quaternion::operator- | ( |  | ) | const

inline

Get the negation.

Definition at line 115 of file Quaternion.hxx.

References degenerate, Quaternion(), space, and time.

Quaternion & Zeni::Quaternion::operator-= | ( | const Quaternion & | rhs | ) |

inline

Set equal to the difference.

Definition at line 56 of file Quaternion.hxx.

References degenerate, space, and time.

Quaternion Zeni::Quaternion::operator/ | ( | const float & | rhs | ) | const

inline

Get the scalar... something.

Definition at line 99 of file Quaternion.hxx.

References degenerate, Quaternion(), space, and time.

Quaternion & Zeni::Quaternion::operator/= | ( | const float & | rhs | ) |

inline

Set equal to the scalar something.

Definition at line 109 of file Quaternion.hxx.

References space, and time.

const float & Zeni::Quaternion::operator[] | ( | const int & | index | ) | const

inline

Get 'index'.

Definition at line 229 of file Quaternion.hxx.

References assert, and time.

float & Zeni::Quaternion::operator[] | ( | const int & | index | ) |

inline

Get 'index'.

Definition at line 235 of file Quaternion.hxx.

References assert, and time.

Quaternion Zeni::Quaternion::reciprocal | ( |  | ) | const

inline

Definition at line 131 of file Quaternion.hxx.

References conjugate(), and time.

Quaternion Zeni::Quaternion::Vector3f_to_Vector3f | ( | const Vector3f & | destination,
|  | const Vector3f & | source
| ) |  |

static

Create a Quaternion rotating to one Vector3f from another.

Definition at line 33 of file Quaternion.cpp.

References Zeni::Vector3f::angle_between(), Axis_Angle(), degenerate, Zeni::Vector3f::i, INFINTESSIMAL, Zeni::Vector3f::j, Zeni::Vector3f::k, normalized(), Zeni::Global::pi, and Quaternion().

## Member Data Documentation

bool Zeni::Quaternion::degenerate

Definition at line 107 of file Quaternion.h.

Referenced by absolute_value(), conjugate(), determinant(), euclidean_even_product(), euclidean_odd_product(), euclidean_product(), Forward_Up(), grassman_even_product(), grassman_odd_product(), grassman_product(), norm(), normalize(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator/(), and Vector3f_to_Vector3f().

Vector3f Zeni::Quaternion::space

Definition at line 105 of file Quaternion.h.

Referenced by conjugate(), euclidean_even_product(), euclidean_odd_product(), euclidean_product(), get_matrix(), get_rotation(), grassman_even_product(), grassman_odd_product(), grassman_product(), magnitude2(), normalize(), normalized(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), Quaternion(), Zeni::serialize(), and Zeni::unserialize().

float Zeni::Quaternion::time

Definition at line 104 of file Quaternion.h.

Referenced by Axis_Angle(), conjugate(), euclidean_even_product(), euclidean_odd_product(), euclidean_product(), get_matrix(), get_rotation(), grassman_even_product(), grassman_product(), magnitude2(), normalize(), normalized(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator[](), Quaternion(), reciprocal(), Zeni::serialize(), and Zeni::unserialize().

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

- zenilib/jni/external/zenilib/zeni/Zeni/Quaternion.h
- zenilib/jni/external/zenilib/zeni/Quaternion.cpp
- zenilib/jni/external/zenilib/zeni/Zeni/Quaternion.hxx