Commits

Frederic De Groef committed 994ddef

yanked code from 1st version

  • Participants
  • Parent commits f808ead

Comments (0)

Files changed (3)

File src/demo_matplotlib.py

 
 if __name__ == '__main__':
     w, h = 256,256
-    grads = Gradients(256)
-
+    p, n = 0.5, 4
     values = np.zeros((w, h))
     for i in range(w-1):
         for j in range(h-1):
             x, y = float(i)/(w), float(j)/(h)
-            values[i, j] = noise.perlin_noise(x, y, grads) 
+            values[i, j] = noise.perlin_noise(x, y, p, n) 
 
-        
+
+    #normalize & show 
     values/=values.max()
     plt.imshow(values, cmap=plt.cm.gray)
     plt.colorbar()

File src/demo_pil.py

 
     for p in [0.1, 0.25, 0.5, 0.75, 1.0]:
         for n in range(1, 10):
-            values = noise.make_perlin_noise(w, h, p, n, grads)
+            values = noise.make_perlin_noise(w, h, p, n)
             values /= values.max()
             make_image2D(values, n, p, outdir)
 

File src/noise.py

 
 
 import random
+import math as m
 
-import math as m
-import os
 
+#p = range(256)
+#random.shuffle(p)
 
 p = [51, 3, 190, 211, 218, 30, 27, 64, 65, 158, 42, 99, 78, 48,
  238, 245, 228, 243, 38, 98, 2, 115, 226, 210, 36, 87, 9, 101, 23, 63,