# Quaternion Struct

## Definition

Important

Some information relates to prerelease product that may be substantially modified before itâ€™s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Represents a vector that is used to encode three-dimensional physical rotations.

`public value class Quaternion : IEquatable<System::Numerics::Quaternion>`

`public struct Quaternion : IEquatable<System.Numerics.Quaternion>`

`type Quaternion = struct`

```
Public Structure Quaternion
Implements IEquatable(Of Quaternion)
```

- Inheritance

- Implements

## Remarks

The Quaternion structure is used to efficiently rotate an object about the (x,y,z) vector by the angle theta, where:

```
w = cos(theta/2)
```

## Constructors

Quaternion(Single, Single, Single, Single) |
Constructs a quaternion from the specified components. |

Quaternion(Vector3, Single) |
Creates a quaternion from the specified vector and rotation parts. |

## Fields

W |
The rotation component of the quaternion. |

X |
The X value of the vector component of the quaternion. |

Y |
The Y value of the vector component of the quaternion. |

Z |
The Z value of the vector component of the quaternion. |

## Properties

Identity |
Gets a quaternion that represents no rotation. |

IsIdentity |
Gets a value that indicates whether the current instance is the identity quaternion. |

Item[Int32] |
Gets or sets the element at the specified index. |

Zero |
Gets a quaternion that represents a zero. |

## Methods

Add(Quaternion, Quaternion) |
Adds each element in one quaternion with its corresponding element in a second quaternion. |

Concatenate(Quaternion, Quaternion) |
Concatenates two quaternions. |

Conjugate(Quaternion) |
Returns the conjugate of a specified quaternion. |

CreateFromAxisAngle(Vector3, Single) |
Creates a quaternion from a unit vector and an angle to rotate around the vector. |

CreateFromRotationMatrix(Matrix4x4) |
Creates a quaternion from the specified rotation matrix. |

CreateFromYawPitchRoll(Single, Single, Single) |
Creates a new quaternion from the given yaw, pitch, and roll. |

Divide(Quaternion, Quaternion) |
Divides one quaternion by a second quaternion. |

Dot(Quaternion, Quaternion) |
Calculates the dot product of two quaternions. |

Equals(Object) |
Returns a value that indicates whether this instance and a specified object are equal. |

Equals(Quaternion) |
Returns a value that indicates whether this instance and another quaternion are equal. |

GetHashCode() |
Returns the hash code for this instance. |

Inverse(Quaternion) |
Returns the inverse of a quaternion. |

Length() |
Calculates the length of the quaternion. |

LengthSquared() |
Calculates the squared length of the quaternion. |

Lerp(Quaternion, Quaternion, Single) |
Performs a linear interpolation between two quaternions based on a value that specifies the weighting of the second quaternion. |

Multiply(Quaternion, Quaternion) |
Returns the quaternion that results from multiplying two quaternions together. |

Multiply(Quaternion, Single) |
Returns the quaternion that results from scaling all the components of a specified quaternion by a scalar factor. |

Negate(Quaternion) |
Reverses the sign of each component of the quaternion. |

Normalize(Quaternion) |
Divides each component of a specified Quaternion by its length. |

Slerp(Quaternion, Quaternion, Single) |
Interpolates between two quaternions, using spherical linear interpolation. |

Subtract(Quaternion, Quaternion) |
Subtracts each element in a second quaternion from its corresponding element in a first quaternion. |

ToString() |
Returns a string that represents this quaternion. |

## Operators

Addition(Quaternion, Quaternion) |
Adds each element in one quaternion with its corresponding element in a second quaternion. |

Division(Quaternion, Quaternion) |
Divides one quaternion by a second quaternion. |

Equality(Quaternion, Quaternion) |
Returns a value that indicates whether two quaternions are equal. |

Inequality(Quaternion, Quaternion) |
Returns a value that indicates whether two quaternions are not equal. |

Multiply(Quaternion, Quaternion) |
Returns the quaternion that results from multiplying two quaternions together. |

Multiply(Quaternion, Single) |
Returns the quaternion that results from scaling all the components of a specified quaternion by a scalar factor. |

Subtraction(Quaternion, Quaternion) |
Subtracts each element in a second quaternion from its corresponding element in a first quaternion. |

UnaryNegation(Quaternion) |
Reverses the sign of each component of the quaternion. |