based on the angle of rotation it is cos(š/2)
based on the angle of rotation and x component of the axis of rotation it is sin(š/2)*axis.x
based on the angle of rotation and y component of the axis of rotation it is sin(š/2)*axis.y
based on the angle of rotation and z component of the axis of rotation it is sin(š/2)*axis.z
Allocates a new #CoglQuaternion on the stack and initializes it with
the same values as src
.
Frees a #CoglQuaternion that was previously allocated via cogl_quaternion_copy().
Initializes a quaternion that rotates angle
degrees around the
axis vector (x,
y,
z)
. The axis vector does not need to be
normalized.
The angle you want to rotate around the given axis
The x component of your axis vector about which you want to rotate.
The y component of your axis vector about which you want to rotate.
The z component of your axis vector about which you want to rotate.
Initializes a quaternion that rotates angle
degrees around the
given axis
vector. The axis vector does not need to be
normalized.
The angle to rotate around axis3
f
your 3 component axis vector about which you want to rotate.
Initializes a [w (x, y,z)] quaternion directly from an array of 4 floats: [w,x,y,z].
An array of 4 floats w,(x,y,z)
XXX: check which direction this rotates
The angle to rotate around the x axis
Initializes the quaternion with the canonical quaternion identity [1 (0, 0, 0)] which represents no rotation. Multiplying a quaternion with this identity leaves the quaternion unchanged.
You might also want to consider using cogl_get_static_identity_quaternion().
This combines the rotations of two quaternions into result
. The
operation is not commutative so the order is important because AxB
!= BxA. Cogl follows the standard convention for quaternions here
so the rotations are applied right
to left
. This is similar to the
combining of matrices.
a
quaternion in-place, so
result
can be equal to a
but can't be equal to b
.
The second #CoglQuaternion rotation to apply
The first #CoglQuaternion rotation to apply
Performs a normalized linear interpolation between two quaternions. That is it does a linear interpolation of the quaternion components and then normalizes the result. This will follow the shortest arc between the two orientations (just like the slerp() function) but will not progress at a constant speed. Unlike slerp() nlerp is commutative which is useful if you are blending animations together. (I.e. nlerp (tmp, a, b) followed by nlerp (result, tmp, d) is the same as nlerp (tmp, a, d) followed by nlerp (result, tmp, b)). Finally nlerp is cheaper than slerp so it can be a good choice if you don't need the constant speed property of the slerp() function.
Notable properties:
The first #CoglQuaternion
The second #CoglQuaternion
The factor in the range [0,1] used to interpolate between quaterion a
and b
.
Performs a spherical linear interpolation between two quaternions.
Noteable properties:
The first #CoglQuaternion
The second #CoglQuaternion
The factor in the range [0,1] used to interpolate between quaternion a
and b
.
Compares that all the components of quaternions a
and b
are
equal.
An epsilon value is not used to compare the float components, but the == operator is at least used so that 0 and -0 are considered equal.
A #CoglQuaternion
A #CoglQuaternion
A quaternion is comprised of a scalar component and a 3D vector component. The scalar component is normally referred to as w and the vector might either be referred to as v or a (for axis) or expanded with the individual components: (x, y, z) A full quaternion would then be written as[w (x, y, z)] .
Quaternions can be considered to represent an axis and angle pair although sadly these numbers are buried somewhat under some maths...
For the curious you can see here that a given axis (a) and angle (š) pair are represented in a quaternion as follows: |[ [w=cos(š/2) ( x=sin(š/2)*a.x, y=sin(š/2)*a.y, z=sin(š/2)*a.x )]
and a unit quaternion satisfies this equation: |[ wĀ² + xĀ² + yĀ² + zĀ² = 1