X-Git-Url: https://git.ctpug.org.za/?p=tabakrolletjie.git;a=blobdiff_plain;f=misc%2Fspiral.py;fp=misc%2Fspiral.py;h=6280ddc94e739726ed9fb3456fdfca0f78ab8818;hp=0000000000000000000000000000000000000000;hb=ff511928a9e814b987399cf6d8a58cfe0b49a7fe;hpb=5077595fe6b25b24977d05bb2a88d79bf74d1e31 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)