-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewLandscape.py
29 lines (25 loc) · 886 Bytes
/
viewLandscape.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import plotly.graph_objects as go # https://plot.ly/python/3d-surface-plots/
from hydro_erosion.utilities import readCSV, normalizeNoiseMap, dim
from mayavi import mlab
# Render map
def viewMap(map):
viewMapMayavi(map)
def viewMapPlotly(map):
fig = go.Figure(data=[go.Surface(
z=map,
x=[i for i in range(len(map))],
y=[i for i in range(len(map[0]))]
)])
fig.update_layout(margin=dict(l=0, r=0, b=0, t=0))
fig.show()
def viewMapMayavi(map, factor=40):
# print(sum([sum(i)/len(i) for i in map])/len(map))
map = normalizeNoiseMap(map, 0, factor)
# map = [[j*factor for j in i] for i in map]
# print(sum([sum(i)/len(i) for i in map])/len(map))
mlab.surf(map)
mlab.show()
if __name__ == '__main__':
surf = readCSV('./maps/processed/erodedmap.csv')
# surf = readCSV('./maps/raw/heightmap.csv')
viewMap(surf)