Defines a quaternion of the form:
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=real64), | public | :: | w |
The real component of the quaternion. |
|||
| real(kind=real64), | public | :: | x |
The first element in the imaginary component of the quaternion. |
|||
| real(kind=real64), | public | :: | y |
The second element in the imaginary component of the quaternion. |
|||
| real(kind=real64), | public | :: | z |
The third element in the imaginary component of the quaternion. |
Constructs a quaternion from a 4-element array stored such that [w, x, y, z].
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(in), | dimension(4) | :: | x |
The array from which to initialize the quaternion stored in the order [w, x, y, z]. |
The resulting quaternion.
Constructs a quaternion given an axis and the angle of rotation about the axis.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(in) | :: | angle |
The rotation angle, in radians. |
||
| real(kind=real64), | intent(in), | dimension(3) | :: | axis |
A 3-element vector defining the axis about which the rotation occurrs. |
The resulting quaternion.
Constructs a quaternion from a 3-by-3 rotation matrix using the Stanley method.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(in), | dimension(3, 3) | :: | r |
The rotation matrix. |
The resulting quaternion.
Normalizes the quaternion.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(quaternion), | intent(inout) | :: | q |
On input, the quaternion to normalize. On output, the normalized quaternion. |
Converts the quaternion to the equivalent angle-axis form.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(quaternion), | intent(in) | :: | q |
The quaternion. |
||
| real(kind=real64), | intent(out) | :: | angle |
The rotation angle, in radians. |
||
| real(kind=real64), | intent(out) | :: | axis(3) |
The axis of rotation. |
Converts a quaternion to a 4-element array of the form [w, x, y, z].
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(quaternion), | intent(in) | :: | q |
The quaternion. |
The array of the form [w, x, y, z].
Converts the quaternion to a 3-by-3 rotation matrix.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(quaternion), | intent(in) | :: | q |
The quaternion. |
The resulting rotation matrix.
Converts the quaternion to the equivalent Euler angles of roll, pitch, and yaw.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(quaternion), | intent(in) | :: | q |
The quaternion. |
||
| real(kind=real64), | intent(out) | :: | roll |
The roll angle (rotation about the body x-axis), in radians. |
||
| real(kind=real64), | intent(out) | :: | pitch |
The pitch angle (rotation about the body y-axis), in radians. |
||
| real(kind=real64), | intent(out) | :: | yaw |
The yaw angle (rotation about the body z-axis), in radians. |