
NO_TITLE
Gnome::Graphene::N-Quaternion
Description
A quaternion.
The contents of the Gnome::Graphene::N-Quaternion structure are private and should never be accessed directly.
Class initialization
new
:native-object
Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object :$native-object! )
alloc
Allocates a new Gnome::Graphene::N-Quaternion.
The contents of the returned value are undefined.
method alloc ( --> Gnome::Graphene::Quaternion \)
Methods
add
Adds two Gnome::Graphene::N-Quaternion $a
and $b
.
method add ( N-Object $b, N-Object $res )
$b; a Gnome::Graphene::N-Quaternion
$res; the result of the operation
dot
Computes the dot product of two Gnome::Graphene::N-Quaternion.
method dot ( N-Object $b --> Num )
$b; a Gnome::Graphene::N-Quaternion
Return value; the value of the dot products.
equal
Checks whether the given quaternions are equal.
method equal ( N-Object $b --> gboolean )
$b; a Gnome::Graphene::N-Quaternion
Return value; true if the quaternions are equal.
free
Releases the resources allocated by .alloc()
.
method free ( )
init
Initializes a Gnome::Graphene::N-Quaternion using the given four values.
method init ( Num() $x, Num() $y, Num() $z, Num() $w --> N-Object )
$x; the first component of the quaternion.
$y; the second component of the quaternion.
$z; the third component of the quaternion.
$w; the fourth component of the quaternion.
Return value; the initialized quaternion.
init-from-angle-vec3
Initializes a Gnome::Graphene::N-Quaternion using an $angle
on a specific $axis
.
method init-from-angle-vec3 ( Num() $angle, N-Object $axis --> N-Object )
$angle; the rotation on a given axis, in degrees.
$axis; the axis of rotation, expressed as a vector
Return value; the initialized quaternion.
init-from-angles
Initializes a Gnome::Graphene::N-Quaternion using the values of the [Euler angles](http://en.wikipedia.org/wiki/Euler_angles) on each axis.
See also: .init-from-euler()
method init-from-angles ( Num() $deg-x, Num() $deg-y, Num() $deg-z --> N-Object )
$deg-x; rotation angle on the X axis (yaw), in degrees.
$deg-y; rotation angle on the Y axis (pitch), in degrees.
$deg-z; rotation angle on the Z axis (roll), in degrees.
Return value; the initialized quaternion.
init-from-euler
Initializes a Gnome::Graphene::N-Quaternion using the given Gnome::Graphene::N-Euler.
method init-from-euler ( N-Object $e --> N-Object )
$e; a Gnome::Graphene::N-Euler
Return value; the initialized Gnome::Graphene::N-Quaternion.
init-from-matrix
Initializes a Gnome::Graphene::N-Quaternion using the rotation components of a transformation matrix.
method init-from-matrix ( N-Object $m --> N-Object )
$m; a Gnome::Graphene::N-Matrix
Return value; the initialized quaternion.
init-from-quaternion
Initializes a Gnome::Graphene::N-Quaternion with the values from $src
.
method init-from-quaternion ( N-Object $src --> N-Object )
$src; a Gnome::Graphene::N-Quaternion
Return value; the initialized quaternion.
init-from-radians
Initializes a Gnome::Graphene::N-Quaternion using the values of the [Euler angles](http://en.wikipedia.org/wiki/Euler_angles) on each axis.
See also: .init-from-euler()
method init-from-radians ( Num() $rad-x, Num() $rad-y, Num() $rad-z --> N-Object )
$rad-x; rotation angle on the X axis (yaw), in radians.
$rad-y; rotation angle on the Y axis (pitch), in radians.
$rad-z; rotation angle on the Z axis (roll), in radians.
Return value; the initialized quaternion.
init-from-vec4
Initializes a Gnome::Graphene::N-Quaternion with the values from $src
.
method init-from-vec4 ( N-Object $src --> N-Object )
$src; a graphene_vec4_t
Return value; the initialized quaternion.
init-identity
Initializes a Gnome::Graphene::N-Quaternion using the identity transformation.
method init-identity (--> N-Object )
Return value; the initialized quaternion.
invert
Inverts a Gnome::Graphene::N-Quaternion, and returns the conjugate quaternion of $q
.
method invert ( N-Object $res )
$res; return location for the inverted quaternion
multiply
Multiplies two Gnome::Graphene::N-Quaternion $a
and $b
.
method multiply ( N-Object $b, N-Object $res )
$b; a Gnome::Graphene::N-Quaternion
$res; the result of the operation
normalize
Normalizes a Gnome::Graphene::N-Quaternion.
method normalize ( N-Object $res )
$res; return location for the normalized quaternion
scale
Scales all the elements of a Gnome::Graphene::N-Quaternion $q
using the given scalar factor.
method scale ( Num() $factor, N-Object $res )
$factor; a scaling factor.
$res; the result of the operation
slerp
Interpolates between the two given quaternions using a spherical linear interpolation, or [SLERP](http://en.wikipedia.org/wiki/Slerp), using the given interpolation $factor
.
method slerp ( N-Object $b, Num() $factor, N-Object $res )
$b; a Gnome::Graphene::N-Quaternion
$factor; the linear interpolation factor.
$res; return location for the interpolated quaternion
to-angle-vec3
Converts a quaternion into an $angle
, $axis
pair.
method to-angle-vec3 ( Num() $angle, N-Object $axis )
$angle; (transfer ownership: full) return location for the angle, in degrees.
$axis; return location for the rotation axis
to-angles
Converts a Gnome::Graphene::N-Quaternion to its corresponding rotations on the [Euler angles](http://en.wikipedia.org/wiki/Euler_angles) on each axis.
method to-angles ( Num() $deg-x, Num() $deg-y, Num() $deg-z )
$deg-x; (transfer ownership: full) return location for the rotation angle on the X axis (yaw), in degrees.
$deg-y; (transfer ownership: full) return location for the rotation angle on the Y axis (pitch), in degrees.
$deg-z; (transfer ownership: full) return location for the rotation angle on the Z axis (roll), in degrees.
to-matrix
Converts a quaternion into a transformation matrix expressing the rotation defined by the Gnome::Graphene::N-Quaternion.
method to-matrix ( N-Object $m )
$m; a Gnome::Graphene::N-Matrix
to-radians
Converts a Gnome::Graphene::N-Quaternion to its corresponding rotations on the [Euler angles](http://en.wikipedia.org/wiki/Euler_angles) on each axis.
method to-radians ( Num() $rad-x, Num() $rad-y, Num() $rad-z )
$rad-x; (transfer ownership: full) return location for the rotation angle on the X axis (yaw), in radians.
$rad-y; (transfer ownership: full) return location for the rotation angle on the Y axis (pitch), in radians.
$rad-z; (transfer ownership: full) return location for the rotation angle on the Z axis (roll), in radians.
to-vec4
Copies the components of a Gnome::Graphene::N-Quaternion into a graphene_vec4_t.
method to-vec4 ( N-Object $res )
$res; return location for a graphene_vec4_t