def __truediv__(self, other):
""" Quaternion division with either scalars or quaternions.
The division with a scalar returns the dual quaternion with all
translational elements divided by the scalar.
The division with a dual quaternion returns dq = dq1/dq2 = dq1 * dq2^-1,
hence other divides on the right.
"""
# TODO(ff): Check if this is correct.
print("WARNING: This might not be properly implemented.")
if isinstance(other, DualQuaternion):
return self * other.inverse()
elif isinstance(other, Number):
dq = self.dq.copy()
dq_out = dq / np.float64(other)
return DualQuaternion.from_vector(dq_out)
else:
assert False, "Division is only defined for scalars or dual quaternions."
评论列表
文章目录