Table of Contents

Struct Quaternion

Namespace
Stride.Core.Mathematics
Assembly
Stride.Core.Mathematics.dll

Represents a four dimensional mathematical quaternion.

[DataContract("quaternion")]
[DataStyle(DataStyle.Compact)]
public struct Quaternion : IEquatable<Quaternion>, IFormattable
Implements

Constructors

Quaternion(Vector2, float, float)

Initializes a new instance of the Quaternion struct.

public Quaternion(Vector2 value, float z, float w)

Parameters

value Vector2

A vector containing the values with which to initialize the X and Y components.

z float

Initial value for the Z component of the quaternion.

w float

Initial value for the W component of the quaternion.

Quaternion(Vector3, float)

Initializes a new instance of the Quaternion struct.

public Quaternion(Vector3 value, float w)

Parameters

value Vector3

A vector containing the values with which to initialize the X, Y, and Z components.

w float

Initial value for the W component of the quaternion.

Quaternion(Vector4)

Initializes a new instance of the Quaternion struct.

public Quaternion(Vector4 value)

Parameters

value Vector4

A vector containing the values with which to initialize the components.

Quaternion(float)

Initializes a new instance of the Quaternion struct.

public Quaternion(float value)

Parameters

value float

The value that will be assigned to all components.

Quaternion(float, float, float, float)

Initializes a new instance of the Quaternion struct.

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

Parameters

x float

Initial value for the X component of the quaternion.

y float

Initial value for the Y component of the quaternion.

z float

Initial value for the Z component of the quaternion.

w float

Initial value for the W component of the quaternion.

Quaternion(float[])

Initializes a new instance of the Quaternion struct.

public Quaternion(float[] values)

Parameters

values float[]

The values to assign to the X, Y, Z, and W components of the quaternion. This must be an array with four elements.

Exceptions

ArgumentNullException

Thrown when values is null.

ArgumentOutOfRangeException

Thrown when values contains more or less than four elements.

Fields

Identity

The identity Quaternion (0, 0, 0, 1).

public static readonly Quaternion Identity

Field Value

Quaternion

One

A Quaternion with all of its components set to one.

public static readonly Quaternion One

Field Value

Quaternion

SizeInBytes

The size of the Quaternion type, in bytes.

public static readonly int SizeInBytes

Field Value

int

W

The W component of the quaternion.

public float W

Field Value

float

X

The X component of the quaternion.

public float X

Field Value

float

Y

The Y component of the quaternion.

public float Y

Field Value

float

Z

The Z component of the quaternion.

public float Z

Field Value

float

Zero

A Quaternion with all of its components set to zero.

public static readonly Quaternion Zero

Field Value

Quaternion

Properties

Angle

Gets the angle of the quaternion.

public float Angle { get; }

Property Value

float

The quaternion's angle.

Axis

Gets the axis components of the quaternion.

public Vector3 Axis { get; }

Property Value

Vector3

The axis components of the quaternion.

IsIdentity

Gets a value indicating whether this instance is equivalent to the identity quaternion.

public bool IsIdentity { get; }

Property Value

bool

true if this instance is an identity quaternion; otherwise, false.

IsNormalized

Gets a value indicting whether this instance is normalized.

public bool IsNormalized { get; }

Property Value

bool

this[int]

Gets or sets the component at the specified index.

public float this[int index] { get; set; }

Parameters

index int

The index of the component to access. Use 0 for the X component, 1 for the Y component, 2 for the Z component, and 3 for the W component.

Property Value

float

The value of the X, Y, Z, or W component, depending on the index.

Exceptions

ArgumentOutOfRangeException

Thrown when the index is out of the range [0, 3].

YawPitchRoll

Gets yaw/pitch/roll equivalent of the quaternion

public Vector3 YawPitchRoll { get; }

Property Value

Vector3

Methods

Add(Quaternion, Quaternion)

Adds two quaternions.

public static Quaternion Add(Quaternion left, Quaternion right)

Parameters

left Quaternion

The first quaternion to add.

right Quaternion

The second quaternion to add.

Returns

Quaternion

The sum of the two quaternions.

Add(ref Quaternion, ref Quaternion, out Quaternion)

Adds two quaternions.

public static void Add(ref Quaternion left, ref Quaternion right, out Quaternion result)

Parameters

left Quaternion

The first quaternion to add.

right Quaternion

The second quaternion to add.

result Quaternion

When the method completes, contains the sum of the two quaternions.

AngleBetween(in Quaternion, in Quaternion)

Returns the absolute angle in radians between a and b

public static float AngleBetween(in Quaternion a, in Quaternion b)

Parameters

a Quaternion
b Quaternion

Returns

float

Barycentric(Quaternion, Quaternion, Quaternion, float, float)

Returns a Quaternion containing the 4D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 2D triangle.

public static Quaternion Barycentric(Quaternion value1, Quaternion value2, Quaternion value3, float amount1, float amount2)

Parameters

value1 Quaternion

A Quaternion containing the 4D Cartesian coordinates of vertex 1 of the triangle.

value2 Quaternion

A Quaternion containing the 4D Cartesian coordinates of vertex 2 of the triangle.

value3 Quaternion

A Quaternion containing the 4D Cartesian coordinates of vertex 3 of the triangle.

amount1 float

Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2).

amount2 float

Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3).

Returns

Quaternion

A new Quaternion containing the 4D Cartesian coordinates of the specified point.

Barycentric(ref Quaternion, ref Quaternion, ref Quaternion, float, float, out Quaternion)

Returns a Quaternion containing the 4D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 2D triangle.

public static void Barycentric(ref Quaternion value1, ref Quaternion value2, ref Quaternion value3, float amount1, float amount2, out Quaternion result)

Parameters

value1 Quaternion

A Quaternion containing the 4D Cartesian coordinates of vertex 1 of the triangle.

value2 Quaternion

A Quaternion containing the 4D Cartesian coordinates of vertex 2 of the triangle.

value3 Quaternion

A Quaternion containing the 4D Cartesian coordinates of vertex 3 of the triangle.

amount1 float

Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2).

amount2 float

Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3).

result Quaternion

When the method completes, contains a new Quaternion containing the 4D Cartesian coordinates of the specified point.

BetweenDirections(Vector3, Vector3)

Computes a quaternion corresponding to the rotation transforming the vector source to the vector target.

public static Quaternion BetweenDirections(Vector3 source, Vector3 target)

Parameters

source Vector3

The source vector of the transformation.

target Vector3

The target vector of the transformation.

Returns

Quaternion

The resulting quaternion corresponding to the transformation of the source vector to the target vector.

BetweenDirections(ref Vector3, ref Vector3, out Quaternion)

Computes a quaternion corresponding to the rotation transforming the vector source to the vector target.

public static void BetweenDirections(ref Vector3 source, ref Vector3 target, out Quaternion result)

Parameters

source Vector3

The source vector of the transformation.

target Vector3

The target vector of the transformation.

result Quaternion

The resulting quaternion corresponding to the transformation of the source vector to the target vector.

Conjugate()

Conjugates the quaternion.

public void Conjugate()

Conjugate(in Quaternion)

Conjugates a quaternion.

public static Quaternion Conjugate(in Quaternion value)

Parameters

value Quaternion

The quaternion to conjugate.

Returns

Quaternion

The conjugated quaternion.

Conjugate(ref Quaternion, out Quaternion)

Conjugates a quaternion.

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

Parameters

value Quaternion

The quaternion to conjugate.

result Quaternion

When the method completes, contains the conjugated quaternion.

Dot(in Quaternion, in Quaternion)

Calculates the dot product of two quaternions.

public static float Dot(in Quaternion left, in Quaternion right)

Parameters

left Quaternion

First source quaternion.

right Quaternion

Second source quaternion.

Returns

float

The dot product of the two quaternions.

Dot(ref Quaternion, ref Quaternion, out float)

Calculates the dot product of two quaternions.

public static void Dot(ref Quaternion left, ref Quaternion right, out float result)

Parameters

left Quaternion

First source quaternion.

right Quaternion

Second source quaternion.

result float

When the method completes, contains the dot product of the two quaternions.

Equals(Quaternion)

Determines whether the specified Quaternion is equal to this instance.

public readonly bool Equals(Quaternion other)

Parameters

other Quaternion

The Quaternion to compare with this instance.

Returns

bool

true if the specified Quaternion is equal to this instance; otherwise, false.

Equals(object)

Determines whether the specified object is equal to this instance.

public override readonly bool Equals(object value)

Parameters

value object

The object to compare with this instance.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

Exponential(Quaternion)

Exponentiates a quaternion.

public static Quaternion Exponential(Quaternion value)

Parameters

value Quaternion

The quaternion to exponentiate.

Returns

Quaternion

The exponentiated quaternion.

Exponential(ref Quaternion, out Quaternion)

Exponentiates a quaternion.

public static void Exponential(ref Quaternion value, out Quaternion result)

Parameters

value Quaternion

The quaternion to exponentiate.

result Quaternion

When the method completes, contains the exponentiated quaternion.

GetHashCode()

Returns a hash code for this instance.

public override readonly int GetHashCode()

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

Invert()

Conjugates and renormalizes the quaternion.

public void Invert()

Invert(Quaternion)

Conjugates and renormalizes the quaternion.

public static Quaternion Invert(Quaternion value)

Parameters

value Quaternion

The quaternion to conjugate and renormalize.

Returns

Quaternion

The conjugated and renormalized quaternion.

Invert(ref Quaternion, out Quaternion)

Conjugates and renormalizes the quaternion.

public static void Invert(ref Quaternion value, out Quaternion result)

Parameters

value Quaternion

The quaternion to conjugate and renormalize.

result Quaternion

When the method completes, contains the conjugated and renormalized quaternion.

Length()

Calculates the length of the quaternion.

public readonly float Length()

Returns

float

The length of the quaternion.

Remarks

LengthSquared() may be preferred when only the relative length is needed and speed is of the essence.

LengthSquared()

Calculates the squared length of the quaternion.

public readonly float LengthSquared()

Returns

float

The squared length of the quaternion.

Remarks

This method may be preferred to Length() when only a relative length is needed and speed is of the essence.

Lerp(Quaternion, Quaternion, float)

Performs a linear interpolation between two quaternion.

public static Quaternion Lerp(Quaternion start, Quaternion end, float amount)

Parameters

start Quaternion

Start quaternion.

end Quaternion

End quaternion.

amount float

Value between 0 and 1 indicating the weight of end.

Returns

Quaternion

The linear interpolation of the two quaternions.

Remarks

This method performs the linear interpolation based on the following formula.

start + (end - start) * amount

Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.

Lerp(ref Quaternion, ref Quaternion, float, out Quaternion)

Performs a linear interpolation between two quaternions.

public static void Lerp(ref Quaternion start, ref Quaternion end, float amount, out Quaternion result)

Parameters

start Quaternion

Start quaternion.

end Quaternion

End quaternion.

amount float

Value between 0 and 1 indicating the weight of end.

result Quaternion

When the method completes, contains the linear interpolation of the two quaternions.

Remarks

This method performs the linear interpolation based on the following formula.

start + (end - start) * amount

Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.

Logarithm(Quaternion)

Calculates the natural logarithm of the specified quaternion.

public static Quaternion Logarithm(Quaternion value)

Parameters

value Quaternion

The quaternion whose logarithm will be calculated.

Returns

Quaternion

The natural logarithm of the quaternion.

Logarithm(ref Quaternion, out Quaternion)

Calculates the natural logarithm of the specified quaternion.

public static void Logarithm(ref Quaternion value, out Quaternion result)

Parameters

value Quaternion

The quaternion whose logarithm will be calculated.

result Quaternion

When the method completes, contains the natural logarithm of the quaternion.

LookRotation(in Vector3, in Vector3)

Returns a rotation whose facing direction points towards forward and whose up direction points as close as possible to up.

public static Quaternion LookRotation(in Vector3 forward, in Vector3 up)

Parameters

forward Vector3
up Vector3

Returns

Quaternion

Multiply(Quaternion, float)

Scales a quaternion by the given value.

public static Quaternion Multiply(Quaternion value, float scale)

Parameters

value Quaternion

The quaternion to scale.

scale float

The amount by which to scale the quaternion.

Returns

Quaternion

The scaled quaternion.

Multiply(in Quaternion, in Quaternion)

Modulates a quaternion by another.

public static Quaternion Multiply(in Quaternion left, in Quaternion right)

Parameters

left Quaternion

The first quaternion to modulate.

right Quaternion

The second quaternion to modulate.

Returns

Quaternion

The modulated quaternion.

Multiply(ref Quaternion, ref Quaternion, out Quaternion)

Modulates a quaternion by another.

public static void Multiply(ref Quaternion left, ref Quaternion right, out Quaternion result)

Parameters

left Quaternion

The first quaternion to modulate.

right Quaternion

The second quaternion to modulate.

result Quaternion

When the moethod completes, contains the modulated quaternion.

Multiply(ref Quaternion, float, out Quaternion)

Scales a quaternion by the given value.

public static void Multiply(ref Quaternion value, float scale, out Quaternion result)

Parameters

value Quaternion

The quaternion to scale.

scale float

The amount by which to scale the quaternion.

result Quaternion

When the method completes, contains the scaled quaternion.

Negate(Quaternion)

Reverses the direction of a given quaternion.

public static Quaternion Negate(Quaternion value)

Parameters

value Quaternion

The quaternion to negate.

Returns

Quaternion

A quaternion facing in the opposite direction.

Negate(ref Quaternion, out Quaternion)

Reverses the direction of a given quaternion.

public static void Negate(ref Quaternion value, out Quaternion result)

Parameters

value Quaternion

The quaternion to negate.

result Quaternion

When the method completes, contains a quaternion facing in the opposite direction.

Normalize()

Converts the quaternion into a unit quaternion.

public void Normalize()

Normalize(Quaternion)

Converts the quaternion into a unit quaternion.

public static Quaternion Normalize(Quaternion value)

Parameters

value Quaternion

The quaternion to normalize.

Returns

Quaternion

The normalized quaternion.

Normalize(ref Quaternion, out Quaternion)

Converts the quaternion into a unit quaternion.

public static void Normalize(ref Quaternion value, out Quaternion result)

Parameters

value Quaternion

The quaternion to normalize.

result Quaternion

When the method completes, contains the normalized quaternion.

Rotate(ref Vector3)

Rotates a Vector3 by the specified quaternion rotation.

public readonly void Rotate(ref Vector3 vector)

Parameters

vector Vector3

The vector to rotate.

RotateTowards(in Quaternion, in Quaternion, float)

Rotate current towards target by angle.

public static Quaternion RotateTowards(in Quaternion current, in Quaternion target, float angle)

Parameters

current Quaternion
target Quaternion
angle float

Returns

Quaternion

Remarks

When the angle difference between current and target is less than the given angle, returns target instead of overshooting past it.

RotationAxis(Vector3, float)

Creates a quaternion given a rotation and an axis.

public static Quaternion RotationAxis(Vector3 axis, float angle)

Parameters

axis Vector3

The axis of rotation.

angle float

The angle of rotation.

Returns

Quaternion

The newly created quaternion.

RotationAxis(ref Vector3, float, out Quaternion)

Creates a quaternion given a rotation and an axis.

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

Parameters

axis Vector3

The axis of rotation.

angle float

The angle of rotation.

result Quaternion

When the method completes, contains the newly created quaternion.

RotationMatrix(Matrix)

Creates a quaternion given a rotation matrix.

public static Quaternion RotationMatrix(Matrix matrix)

Parameters

matrix Matrix

The rotation matrix.

Returns

Quaternion

The newly created quaternion.

RotationMatrix(ref Matrix, out Quaternion)

Creates a quaternion given a rotation matrix.

public static void RotationMatrix(ref Matrix matrix, out Quaternion result)

Parameters

matrix Matrix

The rotation matrix.

result Quaternion

When the method completes, contains the newly created quaternion.

RotationX(float)

Creates a quaternion that rotates around the x-axis.

public static Quaternion RotationX(float angle)

Parameters

angle float

Angle of rotation in radians.

Returns

Quaternion

The created rotation quaternion.

RotationX(float, out Quaternion)

Creates a quaternion that rotates around the x-axis.

public static void RotationX(float angle, out Quaternion result)

Parameters

angle float

Angle of rotation in radians.

result Quaternion

When the method completes, contains the newly created quaternion.

RotationY(float)

Creates a quaternion that rotates around the y-axis.

public static Quaternion RotationY(float angle)

Parameters

angle float

Angle of rotation in radians.

Returns

Quaternion

The created rotation quaternion.

RotationY(float, out Quaternion)

Creates a quaternion that rotates around the y-axis.

public static void RotationY(float angle, out Quaternion result)

Parameters

angle float

Angle of rotation in radians.

result Quaternion

When the method completes, contains the newly created quaternion.

RotationYawPitchRoll(ref Quaternion, out float, out float, out float)

Calculate the yaw/pitch/roll rotation equivalent to the provided quaternion.

public static void RotationYawPitchRoll(ref Quaternion rotation, out float yaw, out float pitch, out float roll)

Parameters

rotation Quaternion

The input quaternion

yaw float

The yaw component in radians.

pitch float

The pitch component in radians.

roll float

The roll component in radians.

RotationYawPitchRoll(float, float, float)

Creates a quaternion given a yaw, pitch, and roll value (angles in radians).

public static Quaternion RotationYawPitchRoll(float yaw, float pitch, float roll)

Parameters

yaw float

The yaw of rotation in radians.

pitch float

The pitch of rotation in radians.

roll float

The roll of rotation in radians.

Returns

Quaternion

The newly created quaternion.

RotationYawPitchRoll(float, float, float, out Quaternion)

Creates a quaternion given a yaw, pitch, and roll value (angles in radians).

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

Parameters

yaw float

The yaw of rotation in radians.

pitch float

The pitch of rotation in radians.

roll float

The roll of rotation in radians.

result Quaternion

When the method completes, contains the newly created quaternion.

RotationZ(float)

Creates a quaternion that rotates around the z-axis.

public static Quaternion RotationZ(float angle)

Parameters

angle float

Angle of rotation in radians.

Returns

Quaternion

The created rotation quaternion.

RotationZ(float, out Quaternion)

Creates a quaternion that rotates around the z-axis.

public static void RotationZ(float angle, out Quaternion result)

Parameters

angle float

Angle of rotation in radians.

result Quaternion

When the method completes, contains the newly created quaternion.

Slerp(in Quaternion, in Quaternion, float)

Interpolates between two quaternions, using spherical linear interpolation.

public static Quaternion Slerp(in Quaternion start, in Quaternion end, float amount)

Parameters

start Quaternion

Start quaternion.

end Quaternion

End quaternion.

amount float

Value between 0 and 1 indicating the weight of end.

Returns

Quaternion

The spherical linear interpolation of the two quaternions.

Slerp(ref Quaternion, ref Quaternion, float, out Quaternion)

Interpolates between two quaternions, using spherical linear interpolation.

public static void Slerp(ref Quaternion start, ref Quaternion end, float amount, out Quaternion result)

Parameters

start Quaternion

Start quaternion.

end Quaternion

End quaternion.

amount float

Value between 0 and 1 indicating the weight of end.

result Quaternion

When the method completes, contains the spherical linear interpolation of the two quaternions.

Squad(Quaternion, Quaternion, Quaternion, Quaternion, float)

Interpolates between quaternions, using spherical quadrangle interpolation.

public static Quaternion Squad(Quaternion value1, Quaternion value2, Quaternion value3, Quaternion value4, float amount)

Parameters

value1 Quaternion

First source quaternion.

value2 Quaternion

Second source quaternion.

value3 Quaternion

Thrid source quaternion.

value4 Quaternion

Fourth source quaternion.

amount float

Value between 0 and 1 indicating the weight of interpolation.

Returns

Quaternion

The spherical quadrangle interpolation of the quaternions.

Squad(ref Quaternion, ref Quaternion, ref Quaternion, ref Quaternion, float, out Quaternion)

Interpolates between quaternions, using spherical quadrangle interpolation.

public static void Squad(ref Quaternion value1, ref Quaternion value2, ref Quaternion value3, ref Quaternion value4, float amount, out Quaternion result)

Parameters

value1 Quaternion

First source quaternion.

value2 Quaternion

Second source quaternion.

value3 Quaternion

Thrid source quaternion.

value4 Quaternion

Fourth source quaternion.

amount float

Value between 0 and 1 indicating the weight of interpolation.

result Quaternion

When the method completes, contains the spherical quadrangle interpolation of the quaternions.

SquadSetup(Quaternion, Quaternion, Quaternion, Quaternion)

Sets up control points for spherical quadrangle interpolation.

public static Quaternion[] SquadSetup(Quaternion value1, Quaternion value2, Quaternion value3, Quaternion value4)

Parameters

value1 Quaternion

First source quaternion.

value2 Quaternion

Second source quaternion.

value3 Quaternion

Third source quaternion.

value4 Quaternion

Fourth source quaternion.

Returns

Quaternion[]

An array of three quaternions that represent control points for spherical quadrangle interpolation.

Subtract(Quaternion, Quaternion)

Subtracts two quaternions.

public static Quaternion Subtract(Quaternion left, Quaternion right)

Parameters

left Quaternion

The first quaternion to subtract.

right Quaternion

The second quaternion to subtract.

Returns

Quaternion

The difference of the two quaternions.

Subtract(ref Quaternion, ref Quaternion, out Quaternion)

Subtracts two quaternions.

public static void Subtract(ref Quaternion left, ref Quaternion right, out Quaternion result)

Parameters

left Quaternion

The first quaternion to subtract.

right Quaternion

The second quaternion to subtract.

result Quaternion

When the method completes, contains the difference of the two quaternions.

ToArray()

Creates an array containing the elements of the quaternion.

public float[] ToArray()

Returns

float[]

A four-element array containing the components of the quaternion.

ToString()

Returns a string that represents this instance.

public override readonly string ToString()

Returns

string

A string that represents this instance.

ToString(IFormatProvider)

Returns a string that represents this instance.

public readonly string ToString(IFormatProvider formatProvider)

Parameters

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

ToString(string)

Returns a string that represents this instance.

public readonly string ToString(string format)

Parameters

format string

The format.

Returns

string

A string that represents this instance.

ToString(string, IFormatProvider)

Returns a string that represents this instance.

public readonly string ToString(string format, IFormatProvider formatProvider)

Parameters

format string

The format.

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

Operators

operator +(Quaternion, Quaternion)

Adds two quaternions.

public static Quaternion operator +(Quaternion left, Quaternion right)

Parameters

left Quaternion

The first quaternion to add.

right Quaternion

The second quaternion to add.

Returns

Quaternion

The sum of the two quaternions.

operator ==(in Quaternion, in Quaternion)

Tests for equality between two objects.

public static bool operator ==(in Quaternion left, in Quaternion right)

Parameters

left Quaternion

The first value to compare.

right Quaternion

The second value to compare.

Returns

bool

true if left has the same value as right; otherwise, false.

operator !=(in Quaternion, in Quaternion)

Tests for inequality between two objects.

public static bool operator !=(in Quaternion left, in Quaternion right)

Parameters

left Quaternion

The first value to compare.

right Quaternion

The second value to compare.

Returns

bool

true if left has a different value than right; otherwise, false.

operator *(Quaternion, float)

Scales a quaternion by the given value.

public static Quaternion operator *(Quaternion value, float scale)

Parameters

value Quaternion

The quaternion to scale.

scale float

The amount by which to scale the quaternion.

Returns

Quaternion

The scaled quaternion.

operator *(in Quaternion, in Quaternion)

Multiplies a quaternion by another.

public static Quaternion operator *(in Quaternion left, in Quaternion right)

Parameters

left Quaternion

The first quaternion to multiply.

right Quaternion

The second quaternion to multiply.

Returns

Quaternion

The multiplied quaternion.

operator *(in Quaternion, in Vector3)

Return the vector rotated by the quaternion.

public static Vector3 operator *(in Quaternion left, in Vector3 right)

Parameters

left Quaternion
right Vector3

Returns

Vector3

Remarks

Shorthand for Rotate(ref Vector3)

operator *(float, Quaternion)

Scales a quaternion by the given value.

public static Quaternion operator *(float scale, Quaternion value)

Parameters

scale float

The amount by which to scale the quaternion.

value Quaternion

The quaternion to scale.

Returns

Quaternion

The scaled quaternion.

operator -(Quaternion, Quaternion)

Subtracts two quaternions.

public static Quaternion operator -(Quaternion left, Quaternion right)

Parameters

left Quaternion

The first quaternion to subtract.

right Quaternion

The second quaternion to subtract.

Returns

Quaternion

The difference of the two quaternions.

operator -(Quaternion)

Reverses the direction of a given quaternion.

public static Quaternion operator -(Quaternion value)

Parameters

value Quaternion

The quaternion to negate.

Returns

Quaternion

A quaternion facing in the opposite direction.