Hello. I use the plotly module to easily create 3d visualizations of the resulting images. And when using your code, I noticed such a feature that virtually every created landscape necessarily has very unrealistic maximum and minimum points.
You can check this for yourself by running the provided code snippet.
from hkb_diamondsquare import DiamondSquare
import numpy as np
import plotly.graph_objects as go
def show_terrain(terrain_array):
fig = go.Figure(data=[go.Surface(z=terrain_array)])
fig.update_layout(
title="Terrain Visualization",
autosize=True,
scene=dict(
zaxis=dict(range=[np.min(terrain_array), np.max(terrain_array)]), aspectratio=dict(x=1, y=1, z=0.5)
),
)
fig.show()
map = DiamondSquare.diamond_square(shape=(250, 250), min_height=0, max_height=5, roughness=0.35)
show_terrain(map)
It feels like there is some kind of flaw in the algorithm. I'm pretty sure this problem is not related to rendering issues. But this code in its current form is very poorly applicable for real use.
I understand that the repository is already quite old, but I poorly understand the operation (or rather the implementation) of the presented algorithm, so I cannot say what exactly the problem is.
I would be grateful for any comments.
Hello. I use the plotly module to easily create 3d visualizations of the resulting images. And when using your code, I noticed such a feature that virtually every created landscape necessarily has very unrealistic maximum and minimum points. You can check this for yourself by running the provided code snippet.
It feels like there is some kind of flaw in the algorithm. I'm pretty sure this problem is not related to rendering issues. But this code in its current form is very poorly applicable for real use. I understand that the repository is already quite old, but I poorly understand the operation (or rather the implementation) of the presented algorithm, so I cannot say what exactly the problem is. I would be grateful for any comments.