Skip to content

Commit 94b5cfc

Browse files
committed
Add demo without mayavi
1 parent 4868280 commit 94b5cfc

File tree

1 file changed

+15
-0
lines changed
  • exercises/materials/perlin-noise

1 file changed

+15
-0
lines changed
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from opensimplex import OpenSimplex
2+
import matplotlib.pyplot as plt
3+
4+
def heightmap(n):
5+
noise = OpenSimplex()
6+
z = [[0 for x in range(n)] for y in range(n)]
7+
for i in range(n):
8+
for j in range(n):
9+
z[i][j] = (noise.noise2d(((i + 1) / 10), ((j + 1) / 10)) + 1) * 10
10+
return z
11+
12+
z = heightmap(100)
13+
14+
map = plt.imshow(z, cmap='terrain')
15+
plt.show()

0 commit comments

Comments
 (0)