Quaternion

Quaternion structure

Quaternion is usually used to perform rotation in computer graphics.

public struct Quaternion

Constructors

Name Description
Quaternion(double, double, double, double) Initializes a new instance of the Quaternion class.

Properties

Name Description
Length { get; } Gets the length of the quaternion

Methods

Name Description
static FromAngleAxis(double, Vector3) Creates a quaternion around given axis and rotate in clockwise
static FromEulerAngle(Vector3) Creates quaternion from given Euler angle
static FromEulerAngle(double, double, double) Creates quaternion from given Euler angle
static FromRotation(Vector3, Vector3) Creates a quaternion that rotate from original to destination direction
static Interpolate(float, Quaternion, Quaternion) Populates this quaternion with the interpolated value between the given quaternion arguments for a t between from and to.
Concat(Quaternion) Concatenate two quaternions
Conjugate() Returns a conjugate quaternion of current quaternion
Dot(Quaternion) Dots product
override Equals(object) Check if two quaternions equals
EulerAngles() Converts quaternion to rotation represented by Euler angles All components are in radian
override GetHashCode() Gets the hash code of Quaternion
Inverse() Returns a inverse quaternion of current quaternion
Normalize() Normalize the quaternion
ToAngleAxis(out double, out Vector3)
ToMatrix() Convert the rotation presented by quaternion to transform matrix.
override ToString() Gets the representation of quaternion in string
operator + Operator overloading for +
operator / Operator overloading for /
operator == Equal operator for quaternion
operator != Not-equal operator for quaternion
operator * Operator overloading for * (5 operators)

Fields

Name Description
static readonly Identity The Identity quaternion.
w The w component.
x The x component.
y The y component.
z The z component.

See Also