From: Simon Cross Date: Sun, 11 Sep 2016 00:00:12 +0000 (+0200) Subject: Helper for rendering a spiral. X-Git-Tag: tabakrolletjie-v1.0.0~14 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=ff511928a9e814b987399cf6d8a58cfe0b49a7fe;p=tabakrolletjie.git Helper for rendering a spiral. --- 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)