From ff511928a9e814b987399cf6d8a58cfe0b49a7fe Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Sun, 11 Sep 2016 02:00:12 +0200 Subject: [PATCH] Helper for rendering a spiral. --- misc/spiral.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 misc/spiral.py diff --git a/misc/spiral.py b/misc/spiral.py new file mode 100644 index 0000000..6280ddc --- /dev/null +++ b/misc/spiral.py @@ -0,0 +1,20 @@ +import math +import json + +import pymunk + + +def make_shrub(centre, radial, degrees): + radial = radial * (degrees / 80.) + c = centre + radial.rotated_degrees(degrees) + return [int(round(c.x)), int(round(c.y)), 40] + + +radial = pymunk.Vec2d(40, 0) +centre = pymunk.Vec2d(512, 400) + +obstacles = [] +for d in range(10, 810, 45): + obstacles.append(make_shrub(centre, radial, d)) + +print json.dumps(obstacles) -- 2.34.1