Quaternion Structure
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Defines a four-dimensional vector (x,y,z,w), which is used to efficiently rotate an object about the (x, y, z) vector by the angle theta, where w = cos(theta/2).
Namespace: Microsoft.Xna.Framework
Assembly: Microsoft.Xna.Framework.Math (in Microsoft.Xna.Framework.Math.dll)
Syntax
'Declaration
Public Structure Quaternion
public struct Quaternion
The Quaternion type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Quaternion(Vector3, Single) | Initializes a new instance of Quaternion. | |
Quaternion(Single, Single, Single, Single) | Initializes a new instance of Quaternion. |
Top
Methods
Name | Description | |
---|---|---|
Add(Quaternion, Quaternion) | Adds two Quaternion instances. | |
Add(Quaternion%, Quaternion%, Quaternion%) | Adds two Quaternion instances. | |
Concatenate(Quaternion, Quaternion) | Concatenates two Quaternion instances; the result represents the value1 rotation followed by the value2 rotation. | |
Concatenate(Quaternion%, Quaternion%, Quaternion%) | Concatenates two Quaternion instances; the result represents the value1 rotation followed by the value2 rotation. | |
Conjugate() | Transforms this Quaternion into its conjugate. | |
Conjugate(Quaternion) | Returns the conjugate of a specified Quaternion. | |
Conjugate(Quaternion%, Quaternion%) | Returns the conjugate of a specified Quaternion. | |
CreateFromAxisAngle(Vector3, Single) | Creates a Quaternion from a vector and an angle to rotate about the vector. | |
CreateFromAxisAngle(Vector3%, Single, Quaternion%) | Creates a Quaternion from a vector and an angle to rotate about the vector. | |
CreateFromRotationMatrix(Matrix) | Creates a Quaternion from a rotation Matrix. | |
CreateFromRotationMatrix(Matrix%, Quaternion%) | Creates a Quaternion from a rotation Matrix. | |
CreateFromYawPitchRoll(Single, Single, Single) | Creates a new Quaternion from specified yaw, pitch, and roll angles. | |
CreateFromYawPitchRoll(Single, Single, Single, Quaternion%) | Creates a new Quaternion from specified yaw, pitch, and roll angles. | |
Divide(Quaternion, Quaternion) | Divides a Quaternion by another Quaternion. | |
Divide(Quaternion%, Quaternion%, Quaternion%) | Divides a Quaternion by another Quaternion. | |
Dot(Quaternion, Quaternion) | Calculates the dot product of two Quaternion instances. | |
Dot(Quaternion%, Quaternion%, Single%) | Calculates the dot product of two Quaternion instances. | |
Equals(Object) | Returns a value that indicates whether the current instance is equal to a specified object. (Overrides ValueType.Equals(Object).) | |
Equals(Quaternion) | Determines whether the specified Object is equal to the Quaternion. | |
GetHashCode | Get the hash code of this object. (Overrides ValueType.GetHashCode().) | |
Inverse(Quaternion) | Returns the inverse of a Quaternion. | |
Inverse(Quaternion%, Quaternion%) | Returns the inverse of a Quaternion. | |
Length | Calculates the length of a Quaternion. | |
LengthSquared | Calculates the length squared of a Quaternion. | |
Lerp(Quaternion, Quaternion, Single) | Linearly interpolates between two Quaternion instances. | |
Lerp(Quaternion%, Quaternion%, Single, Quaternion%) | Linearly interpolates between two Quaternion instances. | |
Multiply(Quaternion, Quaternion) | Multiplies two Quaternion instances. | |
Multiply(Quaternion, Single) | Multiplies a Quaternion by a scalar value. | |
Multiply(Quaternion%, Quaternion%, Quaternion%) | Multiplies two Quaternion instances. | |
Multiply(Quaternion%, Single, Quaternion%) | Multiplies a Quaternion by a scalar value. | |
Negate(Quaternion) | Flips the sign of each component of the Quaternion. | |
Negate(Quaternion%, Quaternion%) | Flips the sign of each component of the Quaternion. | |
Normalize() | Divides each component of a Quaternion by the length of the Quaternion. | |
Normalize(Quaternion) | Divides each component of a Quaternion by the length of the Quaternion. | |
Normalize(Quaternion%, Quaternion%) | Divides each component of a Quaternion by the length of the Quaternion. | |
Slerp(Quaternion, Quaternion, Single) | Interpolates between two Quaternion instances, using spherical linear interpolation. | |
Slerp(Quaternion%, Quaternion%, Single, Quaternion%) | Interpolates between two Quaternion instances, using spherical linear interpolation. | |
Subtract(Quaternion, Quaternion) | Subtracts a Quaternion from another Quaternion. | |
Subtract(Quaternion%, Quaternion%, Quaternion%) | Subtracts a Quaternion from another Quaternion. | |
ToString | Retrieves a string representation of the current object. (Overrides ValueType.ToString().) |
Top
Operators
Name | Description | |
---|---|---|
Addition | Adds two Quaternion instances. | |
Division | Divides a Quaternion by another Quaternion. | |
Equality | Compares two Quaternion instances for equality. | |
Inequality | Compare two Quaternion instances for inequality. | |
Multiply(Quaternion, Quaternion) | Multiplies two Quaternion instances. | |
Multiply(Quaternion, Single) | Multiplies a Quaternion by a scalar value. | |
Subtraction | Subtracts a Quaternion from another Quaternion. | |
UnaryNegation | Flips the sign of each component of the Quaternion. |
Top
Fields
Name | Description | |
---|---|---|
W | Specifies the rotation component of the Quaternion. | |
X | Specifies the x-value of the vector component of the Quaternion. | |
Y | Specifies the y-value of the vector component of the Quaternion. | |
Z | Specifies the z-value of the vector component of the Quaternion. |
Top
Remarks
Quaternion instances represent a rotation. Typically, they are used for smooth interpolation between two angles, and for avoiding the gimbal lock problem that can occur with euler angles.
Version Information
Silverlight
Supported in: 5
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.