gen.py 文件源码

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

项目:tree-gen 作者: friggog 项目源码 文件源码
def apply_tropism(turtle, tropism_vector):
    """Apply tropism_vector to turtle direction"""
    h_cross_t = turtle.dir.cross(tropism_vector)
    # calc angle to rotate by (from ABoP) multiply to achieve accurate results from WP attractionUp param
    alpha = 10 * h_cross_t.magnitude
    h_cross_t.normalize()
    # rotate by angle about axis perpendicular to turtle direction and tropism vector
    turtle.dir.rotate(Quaternion(h_cross_t, radians(alpha)))
    turtle.dir.normalize()
    turtle.right.rotate(Quaternion(h_cross_t, radians(alpha)))
    turtle.right.normalize()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号