# Quaternion Structure (Microsoft.Xna.Framework)

An efficient mathematical representation for three dimensional rotations.

- C#
- VB
- F#

[DataContractAttribute] [DebuggerDisplayAttribute("{DebugDisplayString,nq}")] [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = -1, Size = -1)] public struct Quaternion : IEquatable<Quaternion>

Syntax for VB is not yet implemented.

Syntax for F# is not yet implemented.

The Quaternion type exposes the following members.

Platforms | Name | Description | |
---|---|---|---|

Quaternion(float, float, float, float) | Constructs a quaternion with X, Y, Z and W from four values. | ||

Quaternion(Vector3, float) | Constructs a quaternion with X, Y, Z from Vector3 and rotation component from a scalar. | ||

Quaternion(Vector4) | Constructs a quaternion from Vector4. |

Platforms | Name | Description | |
---|---|---|---|

Add(Quaternion, Quaternion) | Creates a new Quaternion that contains the sum of two quaternions. |
||

Add(Quaternion, Quaternion, out Quaternion) | Creates a new Quaternion that contains the sum of two quaternions. |
||

Concatenate(Quaternion, Quaternion) | Creates a new Quaternion that contains concatenation between two quaternion. |
||

Concatenate(Quaternion, Quaternion, out Quaternion) | Creates a new Quaternion that contains concatenation between two quaternion. |
||

Conjugate() | Transforms this quaternion into its conjugated version. | ||

Conjugate(Quaternion) | Creates a new Quaternion that contains conjugated version of the specified quaternion. |
||

Conjugate(Quaternion, out Quaternion) | Creates a new Quaternion that contains conjugated version of the specified quaternion. |
||

CreateFromAxisAngle(Vector3, float) | Creates a new Quaternion from the specified axis and angle. |
||

CreateFromAxisAngle(Vector3, float, out Quaternion) | Creates a new Quaternion from the specified axis and angle. |
||

CreateFromRotationMatrix(Matrix) | Creates a new Quaternion from the specified Matrix. |
||

CreateFromRotationMatrix(Matrix, out Quaternion) | Creates a new Quaternion from the specified Matrix. |
||

CreateFromYawPitchRoll(float, float, float) | Creates a new Quaternion from the specified yaw, pitch and roll angles. |
||

CreateFromYawPitchRoll(float, float, float, out Quaternion) | Creates a new Quaternion from the specified yaw, pitch and roll angles. |
||

Deconstruct | |||

Divide(Quaternion, Quaternion) | Divides a Quaternion by the other Quaternion. |
||

Divide(Quaternion, Quaternion, out Quaternion) | Divides a Quaternion by the other Quaternion. |
||

Dot(Quaternion, Quaternion) | Returns a dot product of two quaternions. | ||

Dot(Quaternion, Quaternion, out Single) | Returns a dot product of two quaternions. | ||

Equals(object) | Compares whether current instance is equal to specified System.Object. (Overrides ValueType.Equals().) | ||

Equals(Quaternion) | Compares whether current instance is equal to specified Quaternion. (Implements IEquatable<T>.Equals().) |
||

GetHashCode | Gets the hash code of this Quaternion. (Overrides ValueType.GetHashCode().) |
||

Inverse(Quaternion) | Returns the inverse quaternion which represents the opposite rotation. | ||

Inverse(Quaternion, out Quaternion) | Returns the inverse quaternion which represents the opposite rotation. | ||

Length | Returns the magnitude of the quaternion components. | ||

LengthSquared | Returns the squared magnitude of the quaternion components. | ||

Lerp(Quaternion, Quaternion, float, out Quaternion) | Performs a linear blend between two quaternions. | ||

Lerp(Quaternion, Quaternion, float) | Performs a linear blend between two quaternions. | ||

Multiply(Quaternion, Quaternion) | Creates a new Quaternion that contains a multiplication of two quaternions. |
||

Multiply(Quaternion, float) | Creates a new Quaternion that contains a multiplication of Quaternion and a scalar. |
||

Multiply(Quaternion, float, out Quaternion) | Creates a new Quaternion that contains a multiplication of Quaternion and a scalar. |
||

Multiply(Quaternion, Quaternion, out Quaternion) | Creates a new Quaternion that contains a multiplication of two quaternions. |
||

Negate(Quaternion) | Flips the sign of the all the quaternion components. | ||

Negate(Quaternion, out Quaternion) | Flips the sign of the all the quaternion components. | ||

Normalize() | Scales the quaternion magnitude to unit length. | ||

Normalize(Quaternion) | Scales the quaternion magnitude to unit length. | ||

Normalize(Quaternion, out Quaternion) | Scales the quaternion magnitude to unit length. | ||

Slerp(Quaternion, Quaternion, float) | Performs a spherical linear blend between two quaternions. | ||

Slerp(Quaternion, Quaternion, float, out Quaternion) | Performs a spherical linear blend between two quaternions. | ||

Subtract(Quaternion, Quaternion, out Quaternion) | Creates a new Quaternion that contains subtraction of one Quaternion from another. |
||

Subtract(Quaternion, Quaternion) | Creates a new Quaternion that contains subtraction of one Quaternion from another. |
||

ToString | Returns a System.String representation of this Quaternion in the format:
{X:[X] Y:[Y] Z:[Z] W:[W]} (Overrides ValueType.ToString().) |
||

ToVector4 | Gets a Vector4 representation for this object. |

Platforms | Name | Description | |
---|---|---|---|

Addition | Adds two quaternions. | ||

Division | Divides a Quaternion by the other Quaternion. |
||

Equality | Compares whether two Quaternion instances are equal. |
||

Inequality | Compares whether two Quaternion instances are not equal. |
||

Multiply(Quaternion, Quaternion) | Multiplies two quaternions. | ||

Multiply(Quaternion, float) | Multiplies the components of quaternion by a scalar. | ||

Subtraction | Subtracts a Quaternion from a Quaternion. |
||

UnaryNegation | Flips the sign of the all the quaternion components. |

Supported in:

Windows DirectX Desktop

Linux Desktop

Windows OpenGL Desktop

Web

Windows DirectX Desktop

Linux Desktop

Windows OpenGL Desktop

Web