Skip to content
This repository was archived by the owner on Dec 13, 2025. It is now read-only.

VRageMath.Quaternion

Morten Aune Lyrstad edited this page Apr 16, 2022 · 54 revisions

IndexNamespace Index

Quaternion Struct

public struct Quaternion: IEquatable<VRageMath.Quaternion>

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: VRageMath
Assembly: VRage.Math.dll

Implements:

Fields

Member Description
static Quaternion Identity
static Quaternion Zero
float W Specifies the rotation component of the quaternion.
float X Specifies the x-value of the vector component of the quaternion.
float Y Specifies the y-value of the vector component of the quaternion.
float Z Specifies the z-value of the vector component of the quaternion.

Properties

Member Description
Vector3 Forward { get; }
Vector3 Right { get; }
Vector3 Up { get; }

Constructors

Member Description
Quaternion(float, float, float, float)
Quaternion(Vector3, float)

Methods

Member Description
static Quaternion Add(Quaternion, Quaternion) Adds two Quaternions.
static void Add(ref Quaternion, ref Quaternion, out Quaternion) Adds two Quaternions.
static Quaternion Concatenate(Quaternion, Quaternion) Concatenates two Quaternions; the result represents the value1 rotation followed by the value2 rotation.
static void Concatenate(ref Quaternion, ref Quaternion, out Quaternion) Concatenates two Quaternions; the result represents the value1 rotation followed by the value2 rotation.
static Quaternion Conjugate(Quaternion) Returns the conjugate of a specified Quaternion.
static void Conjugate(ref Quaternion, out Quaternion) Returns the conjugate of a specified Quaternion.
static Quaternion CreateFromAxisAngle(Vector3, float) Creates a Quaternion from a vector and an angle to rotate about the vector.
static void CreateFromAxisAngle(ref Vector3, float, out Quaternion) Creates a Quaternion from a vector and an angle to rotate about the vector.
static Quaternion CreateFromForwardUp(Vector3, Vector3) Works for normalized vectors only
static Quaternion CreateFromRotationMatrix(ref MatrixD)
static Quaternion CreateFromRotationMatrix(Matrix) Creates a Quaternion from a rotation Matrix.
static void CreateFromRotationMatrix(ref MatrixD, out Quaternion)
static void CreateFromRotationMatrix(ref Matrix, out Quaternion) Creates a Quaternion from a rotation Matrix.
static void CreateFromRotationMatrix(ref Matrix3x3, out Quaternion) Creates a Quaternion from a rotation Matrix.
static void CreateFromTwoVectors(ref Vector3, ref Vector3, out Quaternion)
static Quaternion CreateFromTwoVectors(Vector3, Vector3)
static Quaternion CreateFromYawPitchRoll(float, float, float) Creates a new Quaternion from specified yaw, pitch, and roll angles.
static void CreateFromYawPitchRoll(float, float, float, out Quaternion) Creates a new Quaternion from specified yaw, pitch, and roll angles.
static Quaternion Divide(Quaternion, Quaternion) Divides a Quaternion by another Quaternion.
static void Divide(ref Quaternion, ref Quaternion, out Quaternion) Divides a Quaternion by another Quaternion.
static float Dot(Quaternion, Quaternion) Calculates the dot product of two Quaternions.
static void Dot(ref Quaternion, ref Quaternion, out float) Calculates the dot product of two Quaternions.
static Quaternion FromVector4(Vector4)
static void GetForward(ref Quaternion, out Vector3) Gets forward vector (0,0,-1) transformed by quaternion.
static void GetRight(ref Quaternion, out Vector3) Gets right vector (1,0,0) transformed by quaternion.
static void GetUp(ref Quaternion, out Vector3) Gets up vector (0,1,0) transformed by quaternion.
static Quaternion Inverse(Quaternion) Returns the inverse of a Quaternion.
static void Inverse(ref Quaternion, out Quaternion) Returns the inverse of a Quaternion.
static bool IsZero(Quaternion)
static bool IsZero(Quaternion, float)
static Quaternion Lerp(Quaternion, Quaternion, float) Linearly interpolates between two quaternions.
static void Lerp(ref Quaternion, ref Quaternion, float, out Quaternion) Linearly interpolates between two quaternions.
static Quaternion Multiply(Quaternion, Quaternion) Multiplies two quaternions.
static void Multiply(ref Quaternion, ref Quaternion, out Quaternion) Multiplies two quaternions.
static Quaternion Multiply(Quaternion, float) Multiplies a quaternion by a scalar value.
static void Multiply(ref Quaternion, float, out Quaternion) Multiplies a quaternion by a scalar value.
static Quaternion Negate(Quaternion) Flips the sign of each component of the quaternion.
static void Negate(ref Quaternion, out Quaternion) Flips the sign of each component of the quaternion.
static Quaternion Normalize(Quaternion) Divides each component of the quaternion by the length of the quaternion.
static void Normalize(ref Quaternion, out Quaternion) Divides each component of the quaternion by the length of the quaternion.
static Quaternion Slerp(Quaternion, Quaternion, float) Interpolates between two quaternions, using spherical linear interpolation.
static void Slerp(ref Quaternion, ref Quaternion, float, out Quaternion) Interpolates between two quaternions, using spherical linear interpolation.
static Quaternion Subtract(Quaternion, Quaternion) Subtracts a quaternion from another quaternion.
static void Subtract(ref Quaternion, ref Quaternion, out Quaternion) Subtracts a quaternion from another quaternion.
void Conjugate() Transforms this Quaternion into its conjugate.
bool Equals(Quaternion) Determines whether the specified Object is equal to the Quaternion.
bool Equals(Quaternion, float)
bool Equals(object) Returns a value that indicates whether the current instance is equal to a specified object.
int FindLargestIndex()
void GetAxisAngle(out Vector3, out float)
float GetComponent(int)
int GetHashCode() Get the hash code of this object.
float Length() Calculates the length of a Quaternion.
float LengthSquared() Calculates the length squared of a Quaternion.
void Normalize() Divides each component of the quaternion by the length of the quaternion.
void SetComponent(int, float)
string ToString() Retireves a string representation of the current object.
string ToString(string)
string ToStringAxisAngle([string])
Vector4 ToVector4()

Clone this wiki locally