Contents

simd_quaternion(_:_:)

Declaration

func simd_quaternion(_ from: simd_half3, _ to: simd_half3) -> simd_quath

Parameters

  • from:

    A normalized three-element vector.

  • to:

    A normalized three-element vector.

Discussion

Construct a quaternion that rotates from one vector to another.

The rotation axis is simd_cross(from, to). If from and to point in opposite directions (to within machine precision), an arbitrary rotation axis is chosen, and the angle is pi radians.