Helper for rendering a spiral.
[tabakrolletjie.git] / misc / spiral.py
1 import math
2 import json
3
4 import pymunk
5
6
7 def make_shrub(centre, radial, degrees):
8     radial = radial * (degrees / 80.)
9     c = centre + radial.rotated_degrees(degrees)
10     return [int(round(c.x)), int(round(c.y)), 40]
11
12
13 radial = pymunk.Vec2d(40, 0)
14 centre = pymunk.Vec2d(512, 400)
15
16 obstacles = []
17 for d in range(10, 810, 45):
18     obstacles.append(make_shrub(centre, radial, d))
19
20 print json.dumps(obstacles)