Crazy Eddie's GUI System
0.8.1
|
Class to represent rotation, avoids Gimbal lock. More...
Public Member Functions | |
Quaternion (float w=1.0f, float x=0.0f, float y=0.0f, float z=0.0f) | |
verbatim constructor | |
Quaternion (const Quaternion &v) | |
copy constructor | |
Quaternion & | operator= (const Quaternion &v) |
assignment operator | |
bool | operator== (const Quaternion &v) const |
equality operator | |
bool | operator!= (const Quaternion &v) const |
inequality operator | |
Quaternion | operator- () const |
negation operator | |
Quaternion | operator* (float v) const |
scalar multiplication operator | |
float | dot (const Quaternion &v) const |
quaternion dot product | |
Quaternion | operator+ (const Quaternion &v) const |
addition operator | |
Quaternion | operator* (const Quaternion &v) const |
quaternion multiplication (not commutative!) More... | |
float | length () const |
computers and returns the length of this quaternion | |
float | normalise () |
normalises this quaternion and returns it's length (since it has to be computed anyways) | |
Static Public Member Functions | |
static Quaternion | eulerAnglesRadians (float x, float y, float z) |
constructs a quaternion from euler angles in radians More... | |
static Quaternion | eulerAnglesDegrees (float x, float y, float z) |
constructs a quaternion from euler angles in degrees More... | |
static Quaternion | axisAngleRadians (const Vector3f &axis, float rotation) |
constructs a quaternion from axis and angle around it in radians More... | |
static Quaternion | axisAngleDegrees (const Vector3f &axis, float rotation) |
constructs a quaternion from axis and angle around it in degrees More... | |
static Quaternion | slerp (const Quaternion &left, const Quaternion &right, float position, bool shortestPath=false) |
spherical linear interpolation More... | |
Public Attributes | |
float | d_w |
imaginary part | |
float | d_x |
x component of the vector part | |
float | d_y |
y component of the vector part | |
float | d_z |
z component of the vector part | |
Static Public Attributes | |
static const Quaternion | ZERO |
Quaternion(0, 0, 0, 0) | |
static const Quaternion | IDENTITY |
Quaternion(1, 0, 0, 0) | |
Friends | |
Quaternion | operator* (float v, const Quaternion &q) |
scalar multiplication operator | |
std::ostream & | operator<< (std::ostream &s, const Quaternion &v) |
allows writing the quaternion to std ostream | |
Class to represent rotation, avoids Gimbal lock.
Most people are afraid of Quaternions, you don't have to fully understand them. In CEGUI, you can just think of quaternions as magic opaque boxes that hold rotation data. No need to understand how they work and why. You obviously have to understand what degrees and radians are, I won't go into that here.
How to convert "human readable" rotation data to Quaternions: 1) Euler angles, 3 floating point values x - rotation around X axis (anticlockwise) y - rotation around Y axis (anticlockwise) z - rotation around Z axis (anticlockwise)
The actual rotation is performed in z, y, x order. Keep that in mind!
For these, just use eulerAnglesDegrees or eulerAnglesRadians static methods.
2) Rotation around axis, 1 Vector3 and one degree/radian angle the vector represents the axis (it's length doesn't matter at all), rotation is then performed by rotating given angle anticlockwise around that axis.
For these, use axisAngleDegrees or axisAngleRadians static methods.
|
static |
constructs a quaternion from axis and angle around it in degrees
axis | vector describing the axis of rotation |
rotation | Anticlockwise rotation around given axis |
|
static |
constructs a quaternion from axis and angle around it in radians
axis | vector describing the axis of rotation |
rotation | Anticlockwise rotation around given axis |
|
static |
constructs a quaternion from euler angles in degrees
x | Anticlockwise rotation around X axis |
y | Anticlockwise rotation around Y axis |
z | Anticlockwise rotation around Z axis |
The rotation is performed around Z first, then Y and then X!
|
static |
constructs a quaternion from euler angles in radians
x | Anticlockwise rotation around X axis |
y | Anticlockwise rotation around Y axis |
z | Anticlockwise rotation around Z axis |
The rotation is performed around Z first, then Y and then X!
|
inline |
|
static |
spherical linear interpolation
left | Left keyframe Quaternion |
right | Right keyframe Quaternion |
position | Number from range <0.0, 1.0), the closer this is to 1.0, the closer the interpolation is to the "right" quaternion |
shortestPath | If true, the interpolation is guaranteed to go through the shortest path |