def from_angle_axis(cls, theta, axis):
""" Construct Quaternion from axis-angle representation """
x, y, z = axis
norm = math.sqrt(x*x + y*y + z*z)
if 0 == norm:
return cls([0, 0, 0, 1])
t = math.sin(theta/2) / norm;
return cls([x*t, y*t, z*t, math.cos(theta/2)])
# Properties
评论列表
文章目录