Netlogo 地形创建和传播
我需要一些帮助来设置特定的地形。我有一个 200x200 个补丁的世界,每个补丁的大小为 2 像素。我想做的是从原点开始建造一座小山,然后将高度均匀地分布到世界的边缘。
原点的最高海拔约为:999,边缘周围的补丁的海拔高度接近0。从世界的边缘开始,海拔应该不断增加,直到到达原点但是,我似乎看不到让山延伸到世界的边缘 - 中间有一点凹凸,世界的其他部分完全平坦。
任何人都可以帮助设置地形并解释如何使高度正确扩散吗?
这是我到目前为止的代码:
patches-own [altitude]
to setup
clear-all
ask patch 0 0 [set altitude 1.0]
repeat 100 [diffuse altitude 0.25] ;; this needs to be changed?
scale-patches
color-patches
end
to scale-patches
let low [altitude] of min-one-of patches [altitude] ;; altitude of the lowest patch
let high [altitude] of max-one-of patches [altitude] ;; altitude of the highest patch
let range high - low ; difference from lowest to highest
ask patches [
set altitude altitude - low ; Shift every patch down so lowest altitude is 0
set altitude altitude * 999.0 / range ; Scale every patch so that the lowest is 0 and highest is 999
]
end
to color-patches
ask patches [set pcolor scale-color green altitude 0 1000]
end
I need some help setting up a particular terrain. I have a world that is 200x200 patches and each patch has a size of 2 pixels. What I am trying to do is to make a hill starting at the origin, and then have the altitude evenly spread out to the edges of the world.
The origin would have around the highest altitude: 999, and patches around the edges would have the altitudes closes to 0. From the edges of the world, the altitude should constantly increase, until it gets to the origin However, I can't seem to get the hill to extend out to the edges of the world - there is a little bump in the middle, and the rest of the world is completely flat.
Can anyone help on setting up the terrain and explain how I can get the altitude to diffuse properly?
Here's the code I have so far:
patches-own [altitude]
to setup
clear-all
ask patch 0 0 [set altitude 1.0]
repeat 100 [diffuse altitude 0.25] ;; this needs to be changed?
scale-patches
color-patches
end
to scale-patches
let low [altitude] of min-one-of patches [altitude] ;; altitude of the lowest patch
let high [altitude] of max-one-of patches [altitude] ;; altitude of the highest patch
let range high - low ; difference from lowest to highest
ask patches [
set altitude altitude - low ; Shift every patch down so lowest altitude is 0
set altitude altitude * 999.0 / range ; Scale every patch so that the lowest is 0 and highest is 999
]
end
to color-patches
ask patches [set pcolor scale-color green altitude 0 1000]
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如何将这两行替换
为
:它不使用扩散,但也许它无论如何都能解决您的问题?
How about replacing these two lines:
with this:
It doesn't use diffusion, but maybe it solves your problem anyway?