util.py 文件源码

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

项目:BiblioPixel2 作者: ManiacalLabs 项目源码 文件源码
def pointOnCircle(cx, cy, radius, angle):
    """Calculates the coordinates of a point on a circle given the center point, radius, and angle"""
    angle = math.radians(angle) - (math.pi / 2)
    x = cx + radius * math.cos(angle)
    if x < cx:
        x = math.ceil(x)
    else:
        x = math.floor(x)

    y = cy + radius * math.sin(angle)

    if y < cy:
        y = math.ceil(y)
    else:
        y = math.floor(y)

    return (int(x), int(y))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号