leaf.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:tree-gen 作者: friggog 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号