Struct graphene::Quaternion[][src]

pub struct Quaternion(_);
Expand description

A quaternion.

The contents of the Quaternion structure are private and should never be accessed directly.

Implementations

Adds two Quaternion self and b.

b

a Quaternion

Returns

res

the result of the operation

Computes the dot product of two Quaternion.

b

a Quaternion

Returns

the value of the dot products

Initializes a Quaternion using the given four values.

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

Returns

the initialized quaternion

Initializes a Quaternion using an angle on a specific axis.

angle

the rotation on a given axis, in degrees

axis

the axis of rotation, expressed as a vector

Returns

the initialized quaternion

Initializes a Quaternion using the values of the Euler angles on each axis.

See also: init_from_euler()

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

Returns

the initialized quaternion

Initializes a Quaternion using the given Euler.

e

a Euler

Returns

the initialized Quaternion

Initializes a Quaternion using the rotation components of a transformation matrix.

m

a Matrix

Returns

the initialized quaternion

Initializes a Quaternion with the values from src.

src

a Quaternion

Returns

the initialized quaternion

Initializes a Quaternion using the values of the Euler angles on each axis.

See also: init_from_euler()

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

Returns

the initialized quaternion

Initializes a Quaternion with the values from src.

src

a Vec4

Returns

the initialized quaternion

Initializes a Quaternion using the identity transformation.

Returns

the initialized quaternion

Inverts a Quaternion, and returns the conjugate quaternion of self.

Returns

res

return location for the inverted quaternion

Multiplies two Quaternion self and b.

b

a Quaternion

Returns

res

the result of the operation

Normalizes a Quaternion.

Returns

res

return location for the normalized quaternion

Scales all the elements of a Quaternion self using the given scalar factor.

factor

a scaling factor

Returns

res

the result of the operation

Interpolates between the two given quaternions using a spherical linear interpolation, or SLERP, using the given interpolation factor.

b

a Quaternion

factor

the linear interpolation factor

Returns

res

return location for the interpolated quaternion

Converts a quaternion into an angle, axis pair.

Returns

angle

return location for the angle, in degrees

axis

return location for the rotation axis

Converts a Quaternion to its corresponding rotations on the Euler angles on each axis.

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

Converts a quaternion into a transformation matrix expressing the rotation defined by the Quaternion.

Returns

m

a Matrix

Converts a Quaternion to its corresponding rotations on the Euler angles on each axis.

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

Copies the components of a Quaternion into a Vec4.

Returns

res

return location for a Vec4

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.