utils.py 文件源码

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

项目:snowballing 作者: JoaoFelipe 项目源码 文件源码
def lines_len_in_circle(r, font_size=12, letter_width=7.2):
    """Return the amount of chars that fits each line in a circle according to
    its radius *r*

    Doctest:

    .. doctest::

        >>> lines_len_in_circle(20)
        [2, 5, 2]
    """
    lines = 2 * r // font_size
    positions = [
        x + (font_size // 2) * (-1 if x <= 0 else 1)
        for x in text_y(lines)
    ]
    return [
        int(2 * r * cos(asin(y / r)) / letter_width)
        for y in positions
    ]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号