Class 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).
Inheritance
Namespace: VRageMath
Assembly: VRage.Math.dll
Syntax
public sealed class Quaternion : ValueType, IEquatable<Quaternion>
Constructors
Quaternion(Single, Single, Single, Single)
Initializes a new instance of Quaternion.
Declaration
public Quaternion(float x, float y, float z, float w)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | x | The x-value of the quaternion. |
| System.Single | y | The y-value of the quaternion. |
| System.Single | z | The z-value of the quaternion. |
| System.Single | w | The w-value of the quaternion. |
Quaternion(Vector3, Single)
Initializes a new instance of Quaternion.
Declaration
public Quaternion(Vector3 vectorPart, float scalarPart)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | vectorPart | The vector component of the quaternion. |
| System.Single | scalarPart | The rotation component of the quaternion. |
Fields
Identity
Declaration
public static Quaternion Identity
Field Value
| Type | Description |
|---|---|
| Quaternion |
W
Specifies the rotation component of the quaternion.
Declaration
public float W
Field Value
| Type | Description |
|---|---|
| System.Single |
X
Specifies the x-value of the vector component of the quaternion.
Declaration
public float X
Field Value
| Type | Description |
|---|---|
| System.Single |
Y
Specifies the y-value of the vector component of the quaternion.
Declaration
public float Y
Field Value
| Type | Description |
|---|---|
| System.Single |
Z
Specifies the z-value of the vector component of the quaternion.
Declaration
public float Z
Field Value
| Type | Description |
|---|---|
| System.Single |
Zero
Declaration
public static Quaternion Zero
Field Value
| Type | Description |
|---|---|
| Quaternion |
Properties
Forward
Declaration
public Vector3 Forward { get; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Right
Declaration
public Vector3 Right { get; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Up
Declaration
public Vector3 Up { get; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Methods
Add(Quaternion, Quaternion)
Adds two Quaternions.
Declaration
public static Quaternion Add(Quaternion quaternion1, Quaternion quaternion2)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Quaternion to add. |
| Quaternion | quaternion2 | Quaternion to add. |
Returns
| Type | Description |
|---|---|
| Quaternion |
Add(ref Quaternion, ref Quaternion, out Quaternion)
Adds two Quaternions.
Declaration
public static void Add(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Quaternion to add. |
| Quaternion | quaternion2 | Quaternion to add. |
| Quaternion | result | [OutAttribute] Result of adding the Quaternions. |
Concatenate(Quaternion, Quaternion)
Concatenates two Quaternions; the result represents the value1 rotation followed by the value2 rotation.
Declaration
public static Quaternion Concatenate(Quaternion value1, Quaternion value2)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | value1 | The first Quaternion rotation in the series. |
| Quaternion | value2 | The second Quaternion rotation in the series. |
Returns
| Type | Description |
|---|---|
| Quaternion |
Concatenate(ref Quaternion, ref Quaternion, out Quaternion)
Concatenates two Quaternions; the result represents the value1 rotation followed by the value2 rotation.
Declaration
public static void Concatenate(ref Quaternion value1, ref Quaternion value2, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | value1 | The first Quaternion rotation in the series. |
| Quaternion | value2 | The second Quaternion rotation in the series. |
| Quaternion | result | [OutAttribute] The Quaternion rotation representing the concatenation of value1 followed by value2. |
Conjugate()
Transforms this Quaternion into its conjugate.
Declaration
public void Conjugate()
Conjugate(Quaternion)
Returns the conjugate of a specified Quaternion.
Declaration
public static Quaternion Conjugate(Quaternion value)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | value | The Quaternion of which to return the conjugate. |
Returns
| Type | Description |
|---|---|
| Quaternion |
Conjugate(ref Quaternion, out Quaternion)
Returns the conjugate of a specified Quaternion.
Declaration
public static void Conjugate(ref Quaternion value, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | value | The Quaternion of which to return the conjugate. |
| Quaternion | result | [OutAttribute] An existing Quaternion filled in to be the conjugate of the specified one. |
CreateFromAxisAngle(Vector3, Single)
Creates a Quaternion from a vector and an angle to rotate about the vector.
Declaration
public static Quaternion CreateFromAxisAngle(Vector3 axis, float angle)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | axis | The vector to rotate around. |
| System.Single | angle | The angle to rotate around the vector. |
Returns
| Type | Description |
|---|---|
| Quaternion |
CreateFromAxisAngle(ref Vector3, Single, out Quaternion)
Creates a Quaternion from a vector and an angle to rotate about the vector.
Declaration
public static void CreateFromAxisAngle(ref Vector3 axis, float angle, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | axis | The vector to rotate around. |
| System.Single | angle | The angle to rotate around the vector. |
| Quaternion | result | [OutAttribute] The created Quaternion. |
CreateFromForwardUp(Vector3, Vector3)
Works for normalized vectors only
Declaration
public static Quaternion CreateFromForwardUp(Vector3 forward, Vector3 up)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | forward | |
| Vector3 | up |
Returns
| Type | Description |
|---|---|
| Quaternion |
CreateFromRotationMatrix(Matrix)
Creates a Quaternion from a rotation Matrix.
Declaration
public static Quaternion CreateFromRotationMatrix(Matrix matrix)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix | matrix | The rotation Matrix to create the Quaternion from. |
Returns
| Type | Description |
|---|---|
| Quaternion |
CreateFromRotationMatrix(ref Matrix, out Quaternion)
Creates a Quaternion from a rotation Matrix.
Declaration
public static void CreateFromRotationMatrix(ref Matrix matrix, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix | matrix | The rotation Matrix to create the Quaternion from. |
| Quaternion | result | [OutAttribute] The created Quaternion. |
CreateFromRotationMatrix(ref Matrix3x3, out Quaternion)
Creates a Quaternion from a rotation Matrix.
Declaration
public static void CreateFromRotationMatrix(ref Matrix3x3 matrix, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix3x3 | matrix | The rotation Matrix to create the Quaternion from. |
| Quaternion | result | [OutAttribute] The created Quaternion. |
CreateFromRotationMatrix(in MatrixD)
Declaration
public static Quaternion CreateFromRotationMatrix(in MatrixD matrix)
Parameters
| Type | Name | Description |
|---|---|---|
| MatrixD | matrix |
Returns
| Type | Description |
|---|---|
| Quaternion |
CreateFromRotationMatrix(ref MatrixD, out Quaternion)
Declaration
public static void CreateFromRotationMatrix(ref MatrixD matrix, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| MatrixD | matrix | |
| Quaternion | result |
CreateFromTwoVectors(Vector3, Vector3)
Declaration
public static Quaternion CreateFromTwoVectors(Vector3 firstVector, Vector3 secondVector)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | firstVector | |
| Vector3 | secondVector |
Returns
| Type | Description |
|---|---|
| Quaternion |
CreateFromTwoVectors(ref Vector3, ref Vector3, out Quaternion)
Declaration
public static void CreateFromTwoVectors(ref Vector3 firstVector, ref Vector3 secondVector, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | firstVector | |
| Vector3 | secondVector | |
| Quaternion | result |
CreateFromYawPitchRoll(Single, Single, Single)
Creates a new Quaternion from specified yaw, pitch, and roll angles.
Declaration
public static Quaternion CreateFromYawPitchRoll(float yaw, float pitch, float roll)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | yaw | The yaw angle, in radians, around the y-axis. |
| System.Single | pitch | The pitch angle, in radians, around the x-axis. |
| System.Single | roll | The roll angle, in radians, around the z-axis. |
Returns
| Type | Description |
|---|---|
| Quaternion |
CreateFromYawPitchRoll(Single, Single, Single, out Quaternion)
Creates a new Quaternion from specified yaw, pitch, and roll angles.
Declaration
public static void CreateFromYawPitchRoll(float yaw, float pitch, float roll, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | yaw | The yaw angle, in radians, around the y-axis. |
| System.Single | pitch | The pitch angle, in radians, around the x-axis. |
| System.Single | roll | The roll angle, in radians, around the z-axis. |
| Quaternion | result | [OutAttribute] An existing Quaternion filled in to express the specified yaw, pitch, and roll angles. |
Divide(Quaternion, Quaternion)
Divides a Quaternion by another Quaternion.
Declaration
public static Quaternion Divide(Quaternion quaternion1, Quaternion quaternion2)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source Quaternion. |
| Quaternion | quaternion2 | The divisor. |
Returns
| Type | Description |
|---|---|
| Quaternion |
Divide(ref Quaternion, ref Quaternion, out Quaternion)
Divides a Quaternion by another Quaternion.
Declaration
public static void Divide(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source Quaternion. |
| Quaternion | quaternion2 | The divisor. |
| Quaternion | result | [OutAttribute] Result of the division. |
Dot(Quaternion, Quaternion)
Calculates the dot product of two Quaternions.
Declaration
public static float Dot(Quaternion quaternion1, Quaternion quaternion2)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source Quaternion. |
| Quaternion | quaternion2 | Source Quaternion. |
Returns
| Type | Description |
|---|---|
| System.Single |
Dot(ref Quaternion, ref Quaternion, out Single)
Calculates the dot product of two Quaternions.
Declaration
public static void Dot(ref Quaternion quaternion1, ref Quaternion quaternion2, out float result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source Quaternion. |
| Quaternion | quaternion2 | Source Quaternion. |
| System.Single | result | [OutAttribute] Dot product of the Quaternions. |
Equals(Object)
Returns a value that indicates whether the current instance is equal to a specified object.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | Object to make the comparison with. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Equals(Quaternion)
Determines whether the specified Object is equal to the Quaternion.
Declaration
public bool Equals(Quaternion other)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | other | The Quaternion to compare with the current Quaternion. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Equals(Quaternion, Single)
Declaration
public bool Equals(Quaternion value, float epsilon)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | value | |
| System.Single | epsilon |
Returns
| Type | Description |
|---|---|
| System.Boolean |
FindLargestIndex()
Declaration
public int FindLargestIndex()
Returns
| Type | Description |
|---|---|
| System.Int32 |
FromVector4(Vector4)
Declaration
public static Quaternion FromVector4(Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | v |
Returns
| Type | Description |
|---|---|
| Quaternion |
GetAxisAngle(out Vector3, out Single)
Declaration
public void GetAxisAngle(out Vector3 axis, out float angle)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | axis | |
| System.Single | angle |
GetComponent(Int32)
Declaration
public float GetComponent(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index |
Returns
| Type | Description |
|---|---|
| System.Single |
GetForward(ref Quaternion, out Vector3)
Gets forward vector (0,0,-1) transformed by quaternion.
Declaration
public static void GetForward(ref Quaternion q, out Vector3 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | q | |
| Vector3 | result |
GetHashCode()
Get the hash code of this object.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 |
GetRight(ref Quaternion, out Vector3)
Gets right vector (1,0,0) transformed by quaternion.
Declaration
public static void GetRight(ref Quaternion q, out Vector3 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | q | |
| Vector3 | result |
GetUp(ref Quaternion, out Vector3)
Gets up vector (0,1,0) transformed by quaternion.
Declaration
public static void GetUp(ref Quaternion q, out Vector3 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | q | |
| Vector3 | result |
Inverse(Quaternion)
Returns the inverse of a Quaternion.
Declaration
public static Quaternion Inverse(Quaternion quaternion)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion | Source Quaternion. |
Returns
| Type | Description |
|---|---|
| Quaternion |
Inverse(ref Quaternion, out Quaternion)
Returns the inverse of a Quaternion.
Declaration
public static void Inverse(ref Quaternion quaternion, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion | Source Quaternion. |
| Quaternion | result | [OutAttribute] The inverse of the Quaternion. |
IsZero(Quaternion)
Declaration
public static bool IsZero(Quaternion value)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | value |
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsZero(Quaternion, Single)
Declaration
public static bool IsZero(Quaternion value, float epsilon)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | value | |
| System.Single | epsilon |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Length()
Calculates the length of a Quaternion.
Declaration
public float Length()
Returns
| Type | Description |
|---|---|
| System.Single |
LengthSquared()
Calculates the length squared of a Quaternion.
Declaration
public float LengthSquared()
Returns
| Type | Description |
|---|---|
| System.Single |
Lerp(Quaternion, Quaternion, Single)
Linearly interpolates between two quaternions.
Declaration
public static Quaternion Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source quaternion. |
| Quaternion | quaternion2 | Source quaternion. |
| System.Single | amount | Value indicating how far to interpolate between the quaternions. |
Returns
| Type | Description |
|---|---|
| Quaternion |
Lerp(ref Quaternion, ref Quaternion, Single, out Quaternion)
Linearly interpolates between two quaternions.
Declaration
public static void Lerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source quaternion. |
| Quaternion | quaternion2 | Source quaternion. |
| System.Single | amount | Value indicating how far to interpolate between the quaternions. |
| Quaternion | result | [OutAttribute] The resulting quaternion. |
Multiply(Quaternion, Single)
Multiplies a quaternion by a scalar value.
Declaration
public static Quaternion Multiply(Quaternion quaternion1, float scaleFactor)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source quaternion. |
| System.Single | scaleFactor | Scalar value. |
Returns
| Type | Description |
|---|---|
| Quaternion |
Multiply(Quaternion, Quaternion)
Multiplies two quaternions.
Declaration
public static Quaternion Multiply(Quaternion quaternion1, Quaternion quaternion2)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | The quaternion on the left of the multiplication. |
| Quaternion | quaternion2 | The quaternion on the right of the multiplication. |
Returns
| Type | Description |
|---|---|
| Quaternion |
Multiply(ref Quaternion, Single, out Quaternion)
Multiplies a quaternion by a scalar value.
Declaration
public static void Multiply(ref Quaternion quaternion1, float scaleFactor, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source quaternion. |
| System.Single | scaleFactor | Scalar value. |
| Quaternion | result | [OutAttribute] The result of the multiplication. |
Multiply(ref Quaternion, ref Quaternion, out Quaternion)
Multiplies two quaternions.
Declaration
public static void Multiply(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | The quaternion on the left of the multiplication. |
| Quaternion | quaternion2 | The quaternion on the right of the multiplication. |
| Quaternion | result | [OutAttribute] The result of the multiplication. |
Negate(Quaternion)
Flips the sign of each component of the quaternion.
Declaration
public static Quaternion Negate(Quaternion quaternion)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion | Source quaternion. |
Returns
| Type | Description |
|---|---|
| Quaternion |
Negate(ref Quaternion, out Quaternion)
Flips the sign of each component of the quaternion.
Declaration
public static void Negate(ref Quaternion quaternion, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion | Source quaternion. |
| Quaternion | result | [OutAttribute] Negated quaternion. |
Normalize()
Divides each component of the quaternion by the length of the quaternion.
Declaration
public void Normalize()
Normalize(Quaternion)
Divides each component of the quaternion by the length of the quaternion.
Declaration
public static Quaternion Normalize(Quaternion quaternion)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion | Source quaternion. |
Returns
| Type | Description |
|---|---|
| Quaternion |
Normalize(ref Quaternion, out Quaternion)
Divides each component of the quaternion by the length of the quaternion.
Declaration
public static void Normalize(ref Quaternion quaternion, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion | Source quaternion. |
| Quaternion | result | [OutAttribute] Normalized quaternion. |
SetComponent(Int32, Single)
Declaration
public void SetComponent(int index, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | |
| System.Single | value |
Slerp(Quaternion, Quaternion, Single)
Interpolates between two quaternions, using spherical linear interpolation.
Declaration
public static Quaternion Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source quaternion. |
| Quaternion | quaternion2 | Source quaternion. |
| System.Single | amount | Value that indicates how far to interpolate between the quaternions. |
Returns
| Type | Description |
|---|---|
| Quaternion |
Slerp(ref Quaternion, ref Quaternion, Single, out Quaternion)
Interpolates between two quaternions, using spherical linear interpolation.
Declaration
public static void Slerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source quaternion. |
| Quaternion | quaternion2 | Source quaternion. |
| System.Single | amount | Value that indicates how far to interpolate between the quaternions. |
| Quaternion | result | [OutAttribute] Result of the interpolation. |
Subtract(Quaternion, Quaternion)
Subtracts a quaternion from another quaternion.
Declaration
public static Quaternion Subtract(Quaternion quaternion1, Quaternion quaternion2)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source quaternion. |
| Quaternion | quaternion2 | Source quaternion. |
Returns
| Type | Description |
|---|---|
| Quaternion |
Subtract(ref Quaternion, ref Quaternion, out Quaternion)
Subtracts a quaternion from another quaternion.
Declaration
public static void Subtract(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source quaternion. |
| Quaternion | quaternion2 | Source quaternion. |
| Quaternion | result | [OutAttribute] Result of the subtraction. |
ToString()
Retireves a string representation of the current object.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String |
ToString(String)
Declaration
public string ToString(string format)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | format |
Returns
| Type | Description |
|---|---|
| System.String |
ToStringAxisAngle(String)
Declaration
public string ToStringAxisAngle(string format = "G")
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | format |
Returns
| Type | Description |
|---|---|
| System.String |
ToVector4()
Declaration
public Vector4 ToVector4()
Returns
| Type | Description |
|---|---|
| Vector4 |
Operators
Addition(Quaternion, Quaternion)
Adds two Quaternions.
Declaration
public static Quaternion operator +(Quaternion quaternion1, Quaternion quaternion2)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Quaternion to add. |
| Quaternion | quaternion2 | Quaternion to add. |
Returns
| Type | Description |
|---|---|
| Quaternion |
Division(Quaternion, Quaternion)
Divides a Quaternion by another Quaternion.
Declaration
public static Quaternion operator /(Quaternion quaternion1, Quaternion quaternion2)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source Quaternion. |
| Quaternion | quaternion2 | The divisor. |
Returns
| Type | Description |
|---|---|
| Quaternion |
Equality(Quaternion, Quaternion)
Compares two Quaternions for equality.
Declaration
public static bool operator ==(Quaternion quaternion1, Quaternion quaternion2)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source Quaternion. |
| Quaternion | quaternion2 | Source Quaternion. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Inequality(Quaternion, Quaternion)
Compare two Quaternions for inequality.
Declaration
public static bool operator !=(Quaternion quaternion1, Quaternion quaternion2)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source Quaternion. |
| Quaternion | quaternion2 | Source Quaternion. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Multiply(Quaternion, Single)
Multiplies a quaternion by a scalar value.
Declaration
public static Quaternion operator *(Quaternion quaternion1, float scaleFactor)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source quaternion. |
| System.Single | scaleFactor | Scalar value. |
Returns
| Type | Description |
|---|---|
| Quaternion |
Multiply(Quaternion, Quaternion)
Multiplies two quaternions.
Declaration
public static Quaternion operator *(Quaternion quaternion1, Quaternion quaternion2)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source quaternion. |
| Quaternion | quaternion2 | Source quaternion. |
Returns
| Type | Description |
|---|---|
| Quaternion |
Multiply(Quaternion, Vector3)
Multiplies a vector by a quaternion. Resulting vector rotated by quaternion
Declaration
public static Vector3 operator *(Quaternion quaternion, Vector3 vector)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion | Source quaternion. |
| Vector3 | vector | Vector to be rotated. |
Returns
| Type | Description |
|---|---|
| Vector3 |
Subtraction(Quaternion, Quaternion)
Subtracts a quaternion from another quaternion.
Declaration
public static Quaternion operator -(Quaternion quaternion1, Quaternion quaternion2)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion1 | Source quaternion. |
| Quaternion | quaternion2 | Source quaternion. |
Returns
| Type | Description |
|---|---|
| Quaternion |
UnaryNegation(Quaternion)
Flips the sign of each component of the quaternion.
Declaration
public static Quaternion operator -(Quaternion quaternion)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quaternion | Source quaternion. |
Returns
| Type | Description |
|---|---|
| Quaternion |