-
Notifications
You must be signed in to change notification settings - Fork 0
/
corners.py
39 lines (27 loc) · 991 Bytes
/
corners.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
import random
from geometer import *
def draw(canvas):
size = 64
g = SquareGrid(canvas.center, size, 50, 50)
for p in g.points:
pair = random.choice([
(Point(p.x - size, p.y),
Point(p.x, p.y + size)),
(Point(p.x, p.y + size),
Point(p.x + size, p.y)),
(Point(p.x + size, p.y),
Point(p.x, p.y - size)),
(Point(p.x, p.y - size),
Point(p.x - size, p.y))
])
terminus = random.choice([
Point(p.x - size, p.y),
Point(p.x, p.y + size),
Point(p.x + size, p.y),
Point(p.x, p.y - size)
])
stroke = band(fills, Line.from_origin_with_slope(origin, -5/6).distance_to(p), canvas.diagonal, fuzz=True)
canvas.set_stroke_color(stroke)
# for terminus in pair:
Line(p, terminus).draw(canvas)