Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from python.common.polygon import Polygon
- from python.common.svg import Svg
- from python.less9.transformations import *
- def transform(transformation, polygon, repeats, name="trans"):
- _svg = Svg()
- for i in range(repeats):
- for _line in polygon.lines():
- _svg.add_line(_line)
- polygon.apply_transformation(transformation)
- _svg.save(name)
- def uk1():
- pol = Polygon([(0, 1), (1, 1), (1, 0), (0, 0), (0, 1)])
- pol.apply_transformation(scaling(300, 300))
- trans = combine(translation(5, 10), scaling(1.1, 1.1), rotation(20))
- transform(trans, pol, 11, "uk1")
- def uk2():
- pol = Polygon([(-1, 1), (1, 1), (1, -1), (-1, -1), (-1, 1)])
- pol.apply_transformation(scaling(300, 300))
- trans = combine(scaling(1.1, 0.8), rotation(10))
- transform(trans, pol, 15, "uk2")
- def uk3():
- pol = Polygon([(-1, 1), (1, 1), (1, -1), (-1, -1), (-1, 1)])
- pol.apply_transformation(scaling(50, 50))
- trans = combine(translation(50, 50), scaling(0.9, 0.9), rotation(10), shear(1.3))
- transform(trans, pol, 25, "uk3")
- uk1()
- uk2()
- uk3()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement