def calc_bend_trf(self, bend):
"""calculate the transformations required to 'bend' the leaf out/up from WP"""
normal = self.direction.cross(self.right)
theta_pos = atan2(self.position.y, self.position.x)
theta_bend = theta_pos - atan2(normal.y, normal.x)
bend_trf_1 = Quaternion(Vector([0, 0, 1]), theta_bend * bend)
self.direction.rotate(bend_trf_1)
self.right.rotate(bend_trf_1)
normal = self.direction.cross(self.right)
phi_bend = normal.declination()
if phi_bend > pi / 2:
phi_bend = phi_bend - pi
bend_trf_2 = Quaternion(self.right, phi_bend * bend)
return bend_trf_1, bend_trf_2
评论列表
文章目录