Created
December 8, 2016 10:21
-
-
Save nomelif/fb00c9b3efa244447b8c915445a265cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import numpy as np | |
import random | |
w = h = 1024 | |
data = np.zeros((h, w, 3), dtype=np.uint8) | |
parallellism = 2048 | |
point = np.random.rand(parallellism).reshape((parallellism//2,2)) | |
targets = np.array([[0,0],[1,0],[1.5, 0.5*np.sqrt(3)],[0, np.sqrt(3)], [1, np.sqrt(3)], [-0.5, np.sqrt(3)*0.5]]) | |
maxI = 1600 | |
for iteration in range(maxI): | |
print(iteration / maxI) | |
target = np.array([random.choice(targets) for x in range(parallellism//2)]) | |
point = point + (target - point)*(1/2) | |
coords = 200 * (point + np.array([1, 1])) | |
for x in range(parallellism//2): | |
data[int(coords[x][1]), int(coords[x][0])] = data[int(coords[x][1]), int(coords[x][0])] + [4, 4, 4] | |
img = Image.fromarray(data, "RGB") | |
img.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment