dataset.py 文件源码

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

项目:freehand-zxcalculus-recognition 作者: emmacaort 项目源码 文件源码
def circlepoint(c,r):
    """Generate a point [x,y] lying on a circle by the circle equation.

    Args:
        c (list): The position of circle centre.
        r (float): The radius of the circle.

    Returns:
        A point lies on a circle. The point position is random.
    """
    x = random.uniform(-r,r)  # Randomly find the x position.
    negative = bool(random.getrandbits(1))  # Randomly set whether the point is on the positive y side or negative side.
    y = math.sqrt(r**2-x**2)  # The equation of the circle.
    if negative:
        y = -y
    return [x+c[0],y+c[1]]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号