sketch-a-day/2019/sketch_190130a/sketch_190130a.pyde

15 wiersze
327 B
Python

def setup():
size(500, 500)
def draw():
background(200)
r = 200
p1 = PVector(200, 250)
p2 = PVector(mouseX, mouseY)
ellipse(p1.x, p1.y, r, r)
line(p1.x, p1.y, p2.x, p2.y)
d = dist(p1.x, p1.y, p2.x, p2.y)
theta = asin(r / d)
beta = TWO_PI - HALF_PI - theta
print(degrees(theta))