Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Failed attempt at penrose tiling
- # MRG 07/2014
- import numpy as np
- # 5 vectors pointing toward the points of a pentagon
- dimensions = 5
- starters = np.linspace(0, 2 * np.pi, dimensions + 1)[:-1]
- bVectors = np.array([(np.cos(t), np.sin(t)) for t in starters])
- # A uniform grid of points b/t -10 to 10 in 1000 steps
- xs, ys = np.mgrid[-10:10:1000j, -10:10:1000j]
- # A place to accumulate the computed values
- bGrid = np.zeros((1000, 1000, dimensions))
- for i in range(dimensions):
- bGrid[:, :, i] = np.rint((bVectors[i, 0] * xs) + (bVectors[i, 1] * ys))
- flattened = np.sum(bGrid, axis=2)
- # Plotting etc
- from pylab import cool, figure, imshow, savefig, show
- figure(figsize=(12, 12))
- imshow(flattened)
- cool()
- savefig("attempt.png")
- show()
Advertisement
Add Comment
Please, Sign In to add comment