Creates a unit quaternion that specifies a rotation given by two vectors.

Namespace: DigitalRune.Mathematics.Algebra
Assembly: DigitalRune.Mathematics (in DigitalRune.Mathematics.dll) Version: 1.7.0.0 (1.7.0.9486)

Syntax

C#
public static QuaternionD CreateRotation(
	Vector3D startVector,
	Vector3D rotatedVector
)
Visual Basic
Public Shared Function CreateRotation ( _
	startVector As Vector3D, _
	rotatedVector As Vector3D _
) As QuaternionD
Visual C++
public:
static QuaternionD CreateRotation(
	Vector3D startVector, 
	Vector3D rotatedVector
)

Parameters

startVector
Type: DigitalRune.Mathematics.Algebra..::..Vector3D
The initial vector. (Vector does not need to be normalized.)
rotatedVector
Type: DigitalRune.Mathematics.Algebra..::..Vector3D
The rotated vector. (Vector does not need to be normalized.)

Return Value

The created unit quaternion that would rotate startVector to rotatedVector.

Remarks

The quaternion is set to a rotation that would rotate vector startVector to the orientation of vector rotatedVector.

Exceptions

ExceptionCondition
System..::..ArgumentException The length of the startVector and rotatedVector must not be 0.

See Also