axi/examples/angles.py

29 lines
560 B
Python
Raw Permalink Normal View History

2018-03-13 14:53:50 +00:00
from __future__ import division, print_function
import axi
import math
import random
import sys
2018-03-13 16:43:04 +00:00
BOUNDS = axi.A3_BOUNDS
2018-03-13 14:53:50 +00:00
RADIUS = 4
STEP = 5
def main():
w, h = BOUNDS[-2:]
paths = []
r = RADIUS
for a in range(0, 180, STEP):
a = math.radians(a)
c = math.cos(a)
s = math.sin(a)
paths.append([(-r * c, -r * s), (r * c, r * s)])
d = axi.Drawing(paths)
d = d.center(w, h)
2018-03-13 16:43:04 +00:00
d = d.sort_paths()
2018-03-13 14:53:50 +00:00
d.dump('out.axi')
d.render(bounds=BOUNDS).write_to_png('out.png')
if __name__ == '__main__':
main()