Graphene.Quaternion¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
w |
r |
||
x |
r |
||
y |
r |
||
z |
r |
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Graphene.Quaternion¶
A quaternion.
The contents of the
Graphene.Quaternion
structure are private and should never be accessed directly.New in version 1.0.
- classmethod alloc()¶
- Returns:
the newly allocated
Graphene.Quaternion
- Return type:
Allocates a new
Graphene.Quaternion
.The contents of the returned value are undefined.
New in version 1.0.
- add(b)¶
- Parameters:
- Returns:
the result of the operation
- Return type:
res:
Graphene.Quaternion
Adds two
Graphene.Quaternion
self and b.New in version 1.10.
- dot(b)¶
- Parameters:
- Returns:
the value of the dot products
- Return type:
Computes the dot product of two
Graphene.Quaternion
.New in version 1.0.
- equal(b)¶
- Parameters:
- Returns:
true
if the quaternions are equal- Return type:
Checks whether the given quaternions are equal.
New in version 1.0.
- free()¶
Releases the resources allocated by
Graphene.Quaternion.alloc
().New in version 1.0.
- init(x, y, z, w)¶
- Parameters:
- Returns:
the initialized quaternion
- Return type:
Initializes a
Graphene.Quaternion
using the given four values.New in version 1.0.
- init_from_angle_vec3(angle, axis)¶
- Parameters:
angle (
float
) – the rotation on a given axis, in degreesaxis (
Graphene.Vec3
) – the axis of rotation, expressed as a vector
- Returns:
the initialized quaternion
- Return type:
Initializes a
Graphene.Quaternion
using an angle on a specific axis.New in version 1.0.
- init_from_angles(deg_x, deg_y, deg_z)¶
- Parameters:
- Returns:
the initialized quaternion
- Return type:
Initializes a
Graphene.Quaternion
using the values of the Euler angles on each axis.See also:
Graphene.Quaternion.init_from_euler
()New in version 1.0.
- init_from_euler(e)¶
- Parameters:
e (
Graphene.Euler
) – aGraphene.Euler
- Returns:
the initialized
Graphene.Quaternion
- Return type:
Initializes a
Graphene.Quaternion
using the givenGraphene.Euler
.New in version 1.2.
- init_from_matrix(m)¶
- Parameters:
m (
Graphene.Matrix
) – aGraphene.Matrix
- Returns:
the initialized quaternion
- Return type:
Initializes a
Graphene.Quaternion
using the rotation components of a transformation matrix.New in version 1.0.
- init_from_quaternion(src)¶
- Parameters:
src (
Graphene.Quaternion
) – aGraphene.Quaternion
- Returns:
the initialized quaternion
- Return type:
Initializes a
Graphene.Quaternion
with the values from src.New in version 1.0.
- init_from_radians(rad_x, rad_y, rad_z)¶
- Parameters:
- Returns:
the initialized quaternion
- Return type:
Initializes a
Graphene.Quaternion
using the values of the Euler angles on each axis.See also:
Graphene.Quaternion.init_from_euler
()New in version 1.0.
- init_from_vec4(src)¶
- Parameters:
src (
Graphene.Vec4
) – aGraphene.Vec4
- Returns:
the initialized quaternion
- Return type:
Initializes a
Graphene.Quaternion
with the values from src.New in version 1.0.
- init_identity()¶
- Returns:
the initialized quaternion
- Return type:
Initializes a
Graphene.Quaternion
using the identity transformation.New in version 1.0.
- invert()¶
- Returns:
return location for the inverted quaternion
- Return type:
res:
Graphene.Quaternion
Inverts a
Graphene.Quaternion
, and returns the conjugate quaternion of self.New in version 1.0.
- multiply(b)¶
- Parameters:
- Returns:
the result of the operation
- Return type:
res:
Graphene.Quaternion
Multiplies two
Graphene.Quaternion
self and b.New in version 1.10.
- normalize()¶
- Returns:
return location for the normalized quaternion
- Return type:
res:
Graphene.Quaternion
Normalizes a
Graphene.Quaternion
.New in version 1.0.
- scale(factor)¶
- Parameters:
factor (
float
) – a scaling factor- Returns:
the result of the operation
- Return type:
res:
Graphene.Quaternion
Scales all the elements of a
Graphene.Quaternion
self using the given scalar factor.New in version 1.10.
- slerp(b, factor)¶
- Parameters:
factor (
float
) – the linear interpolation factor
- Returns:
return location for the interpolated quaternion
- Return type:
res:
Graphene.Quaternion
Interpolates between the two given quaternions using a spherical linear interpolation, or SLERP, using the given interpolation factor.
New in version 1.0.
- to_angle_vec3()¶
- Returns:
- angle:
return location for the angle, in degrees
- axis:
return location for the rotation axis
- Return type:
(angle:
float
, axis:Graphene.Vec3
)
Converts a quaternion into an angle, axis pair.
New in version 1.0.
- to_angles()¶
- Returns:
- deg_x:
return location for the rotation angle on the X axis (yaw), in degrees
- deg_y:
return location for the rotation angle on the Y axis (pitch), in degrees
- deg_z:
return location for the rotation angle on the Z axis (roll), in degrees
- Return type:
Converts a
Graphene.Quaternion
to its corresponding rotations on the Euler angles on each axis.New in version 1.2.
- to_matrix()¶
- Returns:
- Return type:
Converts a quaternion into a transformation matrix expressing the rotation defined by the
Graphene.Quaternion
.New in version 1.0.
- to_radians()¶
- Returns:
- rad_x:
return location for the rotation angle on the X axis (yaw), in radians
- rad_y:
return location for the rotation angle on the Y axis (pitch), in radians
- rad_z:
return location for the rotation angle on the Z axis (roll), in radians
- Return type:
Converts a
Graphene.Quaternion
to its corresponding rotations on the Euler angles on each axis.New in version 1.2.
- to_vec4()¶
- Returns:
return location for a
Graphene.Vec4
- Return type:
res:
Graphene.Vec4
Copies the components of a
Graphene.Quaternion
into aGraphene.Vec4
.New in version 1.0.