Quaternion.Multiply(Quaternion) Method (Microsoft.DirectX)

Multiplies two quaternions.

Definition

Visual Basic Public Sub Multiply( _
    ByVal q As Quaternion _
)
C# public void Multiply(
    Quaternion q
);
C++ public:
void Multiply(
    Quaternion q
);
JScript public function Multiply(
    q : Quaternion
);

Parameters

q Microsoft.DirectX.Quaternion
Source Quaternion structure.

Remarks

If the single parameter overload of this method is used, the current Quaternion instance is used as the m1 parameter and the quaternion that is passed in is treated as the m2 parameter.

The result represents the rotation m1 followed by the rotation m2 (return value = m1 * m2). This is done so that Multiply maintains the same semantics as Matrix, because unit quaternions can be considered as another way of representing rotation matrices.

Transformations are concatenated in the same order for the Quaternion.Multiply and Matrix.Multiply methods. In the following C# code example, assuming that mX and mY represent the same rotations as qX and qY, both m and q represent the same rotations.

[C#]

m = Matrix.Multiply(mX, mY);

q = Quaternion.Multiply(qX, qY);

The multiplication of quaternions is not commutative; that is, the order in which they are multiplied is important.

See Also