Accumulate quaternion rotations.
Chain multiplies an Nx4 array of quaternions, accumulating their rotations. This function can be used for computing the orientation of joints in an armature for forward kinematics. The first quaternion is treated as the ‘root’ and the last is the orientation of the end effector.
q (array_like) – Nx4 array of quaternions to accumulate, where each row is a quaternion.
out (ndarray, optional) – Optional output array. Must be same shape and dtype as the expected output if out was not specified. In this case, the same shape as qlist.
dtype (dtype or str, optional) – Data type for computations can either be ‘float32’ or ‘float64’. If out is specified, the data type of out is used and this argument is ignored. If out is not provided, ‘float64’ is used by default.
Nx4 array of quaternions.
ndarray
Examples
Get the orientation of joints in an armature if we know their relative angles:
shoulder = quatFromAxisAngle('-x', 45.0) # rotate shoulder down 45 deg
elbow = quatFromAxisAngle('+x', 45.0) # rotate elbow up 45 deg
wrist = quatFromAxisAngle('-x', 45.0) # rotate wrist down 45 deg
finger = quatFromAxisAngle('+x', 0.0) # keep finger in-line with wrist
armRotations = accumQuat([shoulder, elbow, wrist, finger])