ktk.geometry.get_quaternions

ktk.geometry.get_quaternions#

get_quaternions(T, canonical=False, scalar_first=False)[source]#

Extract quaternions from a transform series.

Parameters:
  • T (ArrayLike) – An Nx4x4 transform series.

  • canonical (bool) – Whether to map the redundant double cover of rotation space to a unique “canonical” single cover. If True, then the quaternion is chosen from {q, -q} such that the w term is positive. If the w term is 0, then the quaternion is chosen such that the first nonzero term of the x, y, and z terms is positive. Default is False.

  • scalar_first (bool) – Optional. If True, the quaternion order is (w, x, y, z). If False, the quaternion order is (x, y, z, w). Default is False.

Returns:

An Nx4 series of quaternions.

Return type:

np.ndarray