# Alias Quaterniond

Alias for double precision Quaternion

``` alias Quaterniond = Quaternion!(double); ```

## Example

``````import dlib.math.transformation;

Quaternionf q1 = Quaternionf(0.0f, 0.0f, 0.0f, 1.0f);
Vector3f v1 = q1.rotate(Vector3f(1.0f, 0.0f, 0.0f));
assert(isAlmostZero(v1 - Vector3f(1.0f, 0.0f, 0.0f)));

Quaternionf q2 = Quaternionf.identity;
assert(isConsiderZero(q2.x));
assert(isConsiderZero(q2.y));
assert(isConsiderZero(q2.z));
assert(isConsiderZero(q2.w - 1.0f));

Quaternionf q3 = Quaternionf([1.0f, 0.0f, 0.0f, 1.0f]);
Quaternionf q4 = Quaternionf([0.0f, 1.0f, 0.0f, 1.0f]);
q4 = q3 * q4;
assert(q4 == Quaternionf(1, 1, 1, 1));

Vector3f v2 = Vector3f(0, 0, 1);
Quaternionf q5 = Quaternionf(v2, 1.0f);
q5 *= q5;
assert(q5 == Quaternionf(0, 0, 2, 0));

Quaternionf q6 = Quaternionf(Vector4f(1, 0, 0, 1));
Quaternionf q7 = q6 + q6 - Quaternionf(2, 0, 0, 2);
assert(q7 == Quaternionf(0, 0, 0, 0));

Quaternionf q8 = Quaternionf(0.5f, 0.5f, 0.5f, 0.0f);
q8.computeW();
assert(q8.w == -0.5f);

Quaternionf q9 = Quaternionf(0.5f, 0.0f, 0.0f, 0.0f);
q9 = q9.normalized;
assert(q9 == Quaternionf(1, 0, 0, 0));

assert(q9 * 2.0f == Quaternionf(2, 0, 0, 0));
assert(3.0f * q9 == Quaternionf(3, 0, 0, 0));
assert(q9 / 2.0f == Quaternionf(0.5f, 0, 0, 0));

Quaternionf q10 = Quaternionf(0.0f, 0.0f, 0.0f, 1.0f);
Matrix4f m1 = q10.toMatrix4x4;
assert(m1 == matrixf(
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1)
);

Matrix3f m2 = q10.toMatrix3x3;
assert(m2 == matrixf(
1, 0, 0,
0, 1, 0,
0, 0, 1)
);

auto m3 = rotationMatrix!float(0, PI);
Quaternionf q11 = Quaternionf.fromMatrix(m3);
assert(q11.toMatrix4x4 == m3);

Vector3f angles = Vector3f(PI * 0.5f, 0.0f, 0.0f);
Quaternionf q12 = Quaternionf.fromEulerAngles(angles);
assert(isAlmostZero(q12.toEulerAngles - angles));
assert(isAlmostZero(q12.rotationAxis - Vector3f(1, 0, 0)));
assert(isConsiderZero(q12.rotationAngle - angles.x));
``````