Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

VRageMath.Quaternion

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

IndexNamespace Index

Quaternion Struct

public struct Quaternion: IEquatable<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

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

Vector3 Forward { get; }

Vector3 Right { get; }

Vector3 Up { get; }

Constructors

Quaternion(float x, float y, float z, float w)

Quaternion(Vector3 vectorPart, float scalarPart)

Methods

static Quaternion Add(Quaternion quaternion1, Quaternion quaternion2)

Adds two Quaternions.

static void Add(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)

Adds two Quaternions.

static Quaternion Concatenate(Quaternion value1, Quaternion value2)

Concatenates two Quaternions; the result represents the value1 rotation followed by the value2 rotation.

static void Concatenate(ref Quaternion value1, ref Quaternion value2, out Quaternion result)

Concatenates two Quaternions; the result represents the value1 rotation followed by the value2 rotation.

static Quaternion Conjugate(Quaternion value)

Returns the conjugate of a specified Quaternion.

static void Conjugate(ref Quaternion value, out Quaternion result)

Returns the conjugate of a specified Quaternion.

static Quaternion CreateFromAxisAngle(Vector3 axis, float angle)

Creates a Quaternion from a vector and an angle to rotate about the vector.

static void CreateFromAxisAngle(ref Vector3 axis, float angle, out Quaternion result)

Creates a Quaternion from a vector and an angle to rotate about the vector.

static Quaternion CreateFromForwardUp(Vector3 forward, Vector3 up)

Works for normalized vectors only

static Quaternion CreateFromRotationMatrix(ref MatrixD matrix)

static Quaternion CreateFromRotationMatrix(Matrix matrix)

Creates a Quaternion from a rotation Matrix.

static void CreateFromRotationMatrix(ref MatrixD matrix, out Quaternion result)

static void CreateFromRotationMatrix(ref Matrix matrix, out Quaternion result)

Creates a Quaternion from a rotation Matrix.

static void CreateFromRotationMatrix(ref Matrix3x3 matrix, out Quaternion result)

Creates a Quaternion from a rotation Matrix.

static void CreateFromTwoVectors(ref Vector3 firstVector, ref Vector3 secondVector, out Quaternion result)

static Quaternion CreateFromTwoVectors(Vector3 firstVector, Vector3 secondVector)

static Quaternion CreateFromYawPitchRoll(float yaw, float pitch, float roll)

Creates a new Quaternion from specified yaw, pitch, and roll angles.

static void CreateFromYawPitchRoll(float yaw, float pitch, float roll, out Quaternion result)

Creates a new Quaternion from specified yaw, pitch, and roll angles.

static Quaternion Divide(Quaternion quaternion1, Quaternion quaternion2)

Divides a Quaternion by another Quaternion.

static void Divide(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)

Divides a Quaternion by another Quaternion.

static float Dot(Quaternion quaternion1, Quaternion quaternion2)

Calculates the dot product of two Quaternions.

static void Dot(ref Quaternion quaternion1, ref Quaternion quaternion2, out float result)

Calculates the dot product of two Quaternions.

static Quaternion FromVector4(Vector4 v)

static void GetForward(ref Quaternion q, out Vector3 result)

Gets forward vector (0,0,-1) transformed by quaternion.

static void GetRight(ref Quaternion q, out Vector3 result)

Gets right vector (1,0,0) transformed by quaternion.

static void GetUp(ref Quaternion q, out Vector3 result)

Gets up vector (0,1,0) transformed by quaternion.

static Quaternion Inverse(Quaternion quaternion)

Returns the inverse of a Quaternion.

static void Inverse(ref Quaternion quaternion, out Quaternion result)

Returns the inverse of a Quaternion.

static bool IsZero(Quaternion value)

static bool IsZero(Quaternion value, float epsilon)

static Quaternion Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount)

Linearly interpolates between two quaternions.

static void Lerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result)

Linearly interpolates between two quaternions.

static Quaternion Multiply(Quaternion quaternion1, Quaternion quaternion2)

Multiplies two quaternions.

static void Multiply(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)

Multiplies two quaternions.

static Quaternion Multiply(Quaternion quaternion1, float scaleFactor)

Multiplies a quaternion by a scalar value.

static void Multiply(ref Quaternion quaternion1, float scaleFactor, out Quaternion result)

Multiplies a quaternion by a scalar value.

static Quaternion Negate(Quaternion quaternion)

Flips the sign of each component of the quaternion.

static void Negate(ref Quaternion quaternion, out Quaternion result)

Flips the sign of each component of the quaternion.

static Quaternion Normalize(Quaternion quaternion)

Divides each component of the quaternion by the length of the quaternion.

static void Normalize(ref Quaternion quaternion, out Quaternion result)

Divides each component of the quaternion by the length of the quaternion.

static Quaternion Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount)

Interpolates between two quaternions, using spherical linear interpolation.

static void Slerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result)

Interpolates between two quaternions, using spherical linear interpolation.

static Quaternion Subtract(Quaternion quaternion1, Quaternion quaternion2)

Subtracts a quaternion from another quaternion.

static void Subtract(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)

Subtracts a quaternion from another quaternion.

void Conjugate()

Transforms this Quaternion into its conjugate.

bool Equals(Quaternion other)

Determines whether the specified Object is equal to the Quaternion.

bool Equals(Quaternion value, float epsilon)

bool Equals(object obj)

Returns a value that indicates whether the current instance is equal to a specified object.

int FindLargestIndex()

void GetAxisAngle(out Vector3 axis, out float angle)

float GetComponent(int index)

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 index, float value)

string ToString()

Retireves a string representation of the current object.

string ToString(string format)

string ToStringAxisAngle(string format = "G")

Vector4 ToVector4()

Clone this wiki locally