コード例 #1
0
 def transform(self):
     # quaternion realizing transformation
     q1 = np.array((np.cos(0.5 * self.axial), 0, 0, np.sin(0.5 * self.axial)))
     q2 = q.axis_mover(self.direction)
     return q.invert(q.prod(q1, q2))
コード例 #2
0
 def transform(self):
     # return quaternion giving coord trans
     # pay attention to vectorization; this might be weird for single rows?
     return q.invert(
         np.column_stack((np.cos(0.5 * self.angle), 0, -1.0 * np.sin(0.5 * self.angle), 0))
     )  # rotate by negative angle