code: def absolute_distance(cls, q0, q1):
          
          q0_minus_q1 = q0 - q1
          q0_plus_q1  = q0 + q1
          d_minus = q0_minus_q1.norm
          d_plus  = q0_plus_q1.norm
          if (d_minus < d_plus):
              return d_minus
          else:
              return d_plus
docs: Quaternion absolute distance.
  
          Find the distance between two quaternions accounting for the sign ambiguity.
  
          Params:
              q0: the first quaternion
              q1: the second quaternion
  
          Returns:
             A positive scalar corresponding to the chord of the shortest path/arc that
             connects q0 to q1.
  
          Note:
             This function does not measure the distance on the hypersphere, but
             it takes into account the fact that q and -q encode the same rotation.
             It is thus a good indicator for rotation similarities.