Quaternions are used to perform linear algebra rotations. More...
| Data Structures | |
| struct | _EPhysics_Quaternion | 
| Quaternion coordinates and rotation (w, x, y, z)  More... | |
| Typedefs | |
| typedef struct _EPhysics_Quaternion | EPhysics_Quaternion | 
| Quaternion handle, represents a quaternion to be used to rotate bodies.  More... | |
| Functions | |
| EAPI EPhysics_Quaternion * | ephysics_quaternion_new (void) | 
| Create a new quaternion.  More... | |
| EAPI void | ephysics_quaternion_get (const EPhysics_Quaternion *quat, double *x, double *y, double *z, double *w) | 
| Get quaternion values.  More... | |
| EAPI void | ephysics_quaternion_axis_angle_get (const EPhysics_Quaternion *quat, double *nx, double *ny, double *nz, double *a) | 
| Get quaternion axis and angle.  More... | |
| EAPI void | ephysics_quaternion_set (EPhysics_Quaternion *quat, double x, double y, double z, double w) | 
| Set quaternion values.  More... | |
| EAPI void | ephysics_quaternion_axis_angle_set (EPhysics_Quaternion *quat, double nx, double ny, double nz, double a) | 
| Set quaternion using axis angle notation.  More... | |
| EAPI void | ephysics_quaternion_euler_set (EPhysics_Quaternion *quat, double yaw, double pitch, double roll) | 
| Set quaternion using Euler angles.  More... | |
| EAPI void | ephysics_quaternion_normalize (EPhysics_Quaternion *quat) | 
| Normalize the quaternion.  More... | |
| EAPI void | ephysics_quaternion_invert (EPhysics_Quaternion *quat) | 
| Invert the quaternion.  More... | |
| EAPI void | ephysics_quaternion_scale (EPhysics_Quaternion *quat, double scale) | 
| Scale the quaternion.  More... | |
| EAPI void | ephysics_quaternion_inverse_scale (EPhysics_Quaternion *quat, double scale) | 
| Inversely scale the quaternion.  More... | |
| EAPI EPhysics_Quaternion * | ephysics_quaternion_sum (const EPhysics_Quaternion *quat1, const EPhysics_Quaternion *quat2, EPhysics_Quaternion *result) | 
| Returns a sum of two quaternions.  More... | |
| EAPI EPhysics_Quaternion * | ephysics_quaternion_diff (const EPhysics_Quaternion *quat1, const EPhysics_Quaternion *quat2, EPhysics_Quaternion *result) | 
| Returns a difference between two quaternions.  More... | |
| EAPI EPhysics_Quaternion * | ephysics_quaternion_multiply (const EPhysics_Quaternion *quat1, const EPhysics_Quaternion *quat2, EPhysics_Quaternion *result) | 
| Multiply two quaternions.  More... | |
| EAPI EPhysics_Quaternion * | ephysics_quaternion_slerp (const EPhysics_Quaternion *quat1, const EPhysics_Quaternion *quat2, double ratio, EPhysics_Quaternion *result) | 
| Return the quaternion which is the result of Spherical Linear Interpolation between two quaternions.  More... | |
| EAPI double | ephysics_quaternion_dot (const EPhysics_Quaternion *quat1, const EPhysics_Quaternion *quat2) | 
| Return the dot product between two quaternions.  More... | |
| EAPI double | ephysics_quaternion_angle_get (const EPhysics_Quaternion *quat1, const EPhysics_Quaternion *quat2) | 
| Return the angle between two quaternions.  More... | |
| EAPI double | ephysics_quaternion_length_get (const EPhysics_Quaternion *quat) | 
| Return the length of the quaternion.  More... | |
| EAPI double | ephysics_quaternion_length2_get (const EPhysics_Quaternion *quat) | 
| Return the length squared of the quaternion.  More... | |
Quaternions are used to perform linear algebra rotations.
Functions regarding rotation, like ephysics_body_rotation_set() and ephysics_body_rotation_get() would need that. Quaternions can be used to rotate evas maps as well, with evas_map_util_quat_rotate(), but in this case quaternion values need to be get with ephysics_quaternion_get(), since evas don't accept EPhysics_Quaternion type.
A quaternion can be created with ephysics_quaternion_new(), and many operations can be performed with that, as:
Quaternion handle, represents a quaternion to be used to rotate bodies.
Created with ephysics_quaternion_new() and deleted with free().
| EAPI EPhysics_Quaternion* ephysics_quaternion_new | ( | void | ) | 
Create a new quaternion.
By default a quaternion is created as identity (w = 1, x = 0, y = 0, z = 0). This values can be modified later by quaternion operations or set directly.
NULL on error.| EAPI void ephysics_quaternion_get | ( | const EPhysics_Quaternion * | quat, | 
| double * | x, | ||
| double * | y, | ||
| double * | z, | ||
| double * | w | ||
| ) | 
Get quaternion values.
| quat | Quaternion to get values from. | 
| x | The x coordinate. | 
| y | The y coordinate. | 
| z | The z coordinate. | 
| w | The rotation. | 
| EAPI void ephysics_quaternion_axis_angle_get | ( | const EPhysics_Quaternion * | quat, | 
| double * | nx, | ||
| double * | ny, | ||
| double * | nz, | ||
| double * | a | ||
| ) | 
Get quaternion axis and angle.
| quat | Quaternion to get values from. | 
| nx | The x component of the axis of rotation. | 
| ny | The y component of the axis of rotation. | 
| nz | The z component of the axis of rotation. | 
| a | The angle of rotation. | 
| EAPI void ephysics_quaternion_set | ( | EPhysics_Quaternion * | quat, | 
| double | x, | ||
| double | y, | ||
| double | z, | ||
| double | w | ||
| ) | 
Set quaternion values.
| quat | Quaternion to be set. | 
| x | The x coordinate. | 
| y | The y coordinate. | 
| z | The z coordinate. | 
| w | The rotation. | 
| EAPI void ephysics_quaternion_axis_angle_set | ( | EPhysics_Quaternion * | quat, | 
| double | nx, | ||
| double | ny, | ||
| double | nz, | ||
| double | a | ||
| ) | 
Set quaternion using axis angle notation.
[w, x, y, z] = [cos(a/2), sin(a/2) * nx, sin(a/2)* ny, sin(a/2) * nz]
| quat | Quaternion to be set. | 
| nx | The x component of the axis of rotation. | 
| ny | The y component of the axis of rotation. | 
| nz | The z component of the axis of rotation. | 
| a | The angle of rotation. | 
| EAPI void ephysics_quaternion_euler_set | ( | EPhysics_Quaternion * | quat, | 
| double | yaw, | ||
| double | pitch, | ||
| double | roll | ||
| ) | 
Set quaternion using Euler angles.
It's an alternative to ephysics_quaternion_set() usage. Euler angles will be converted.
| quat | Quaternion to be set. | 
| yaw | The angle around Y axis. | 
| pitch | The angle around X axis. | 
| roll | The angle around Z axis. | 
| EAPI void ephysics_quaternion_normalize | ( | EPhysics_Quaternion * | quat | ) | 
Normalize the quaternion.
A normalized quaternion is such that x^2 + y^2 + z^2 + w^2 = 1.
| quat | Quaternion to be normalized. | 
| EAPI void ephysics_quaternion_invert | ( | EPhysics_Quaternion * | quat | ) | 
Invert the quaternion.
| quat | Quaternion to be inverted. | 
| EAPI void ephysics_quaternion_scale | ( | EPhysics_Quaternion * | quat, | 
| double | scale | ||
| ) | 
Scale the quaternion.
| quat | Quaternion to be scaled. | 
| scale | The scale factor. | 
| EAPI void ephysics_quaternion_inverse_scale | ( | EPhysics_Quaternion * | quat, | 
| double | scale | ||
| ) | 
Inversely scale the quaternion.
| quat | Quaternion to be scaled. | 
| scale | The scale factor. | 
| EAPI EPhysics_Quaternion* ephysics_quaternion_sum | ( | const EPhysics_Quaternion * | quat1, | 
| const EPhysics_Quaternion * | quat2, | ||
| EPhysics_Quaternion * | result | ||
| ) | 
Returns a sum of two quaternions.
| quat1 | First quaternion to sum. | 
| quat2 | Second quaternion to sum. | 
| result | Quaternion used to store the result. If it's NULL, a new quaternion will be allocated (and should be freed after usage). | 
NULL on error. | EAPI EPhysics_Quaternion* ephysics_quaternion_diff | ( | const EPhysics_Quaternion * | quat1, | 
| const EPhysics_Quaternion * | quat2, | ||
| EPhysics_Quaternion * | result | ||
| ) | 
Returns a difference between two quaternions.
| quat1 | First quaternion. | 
| quat2 | Second quaternion. | 
| result | Quaternion used to store the result. If it's NULL, a new quaternion will be allocated (and should be freed after usage). | 
quat1 and quat2, or NULL on error. | EAPI EPhysics_Quaternion* ephysics_quaternion_multiply | ( | const EPhysics_Quaternion * | quat1, | 
| const EPhysics_Quaternion * | quat2, | ||
| EPhysics_Quaternion * | result | ||
| ) | 
Multiply two quaternions.
| quat1 | First quaternion. | 
| quat2 | Second quaternion. | 
| result | Quaternion used to store the result. If it's NULL, a new quaternion will be allocated (and should be freed after usage). | 
quat1 multiplied by quat2 on the right, or NULL on error. | EAPI EPhysics_Quaternion* ephysics_quaternion_slerp | ( | const EPhysics_Quaternion * | quat1, | 
| const EPhysics_Quaternion * | quat2, | ||
| double | ratio, | ||
| EPhysics_Quaternion * | result | ||
| ) | 
Return the quaternion which is the result of Spherical Linear Interpolation between two quaternions.
Slerp interpolates assuming constant velocity.
| quat1 | First quaternion. | 
| quat2 | Second quaternion. | 
| ratio | The ratio between quat1andquat2to interpolate. Ifratio= 0, the result isquat1, ifratio= 1, the result isquat2. | 
| result | Quaternion used to store the result. If it's NULL, a new quaternion will be allocated (and should be freed after usage). | 
quat1 and quat2, or NULL on error. | EAPI double ephysics_quaternion_dot | ( | const EPhysics_Quaternion * | quat1, | 
| const EPhysics_Quaternion * | quat2 | ||
| ) | 
Return the dot product between two quaternions.
| quat1 | First quaternion. | 
| quat2 | Second quaternion. | 
quat1 and quat2 or 0 on error. | EAPI double ephysics_quaternion_angle_get | ( | const EPhysics_Quaternion * | quat1, | 
| const EPhysics_Quaternion * | quat2 | ||
| ) | 
Return the angle between two quaternions.
| quat1 | First quaternion. | 
| quat2 | Second quaternion. | 
quat1 and quat2 or 0 on error. | EAPI double ephysics_quaternion_length_get | ( | const EPhysics_Quaternion * | quat | ) | 
Return the length of the quaternion.
| quat | Quaternion to get length of. | 
quat or 0 on error. | EAPI double ephysics_quaternion_length2_get | ( | const EPhysics_Quaternion * | quat | ) | 
Return the length squared of the quaternion.
| quat | Quaternion to get length of. | 
quat or 0 on error.