带有netlogo的补丁之间的边到边距离 [英] edge to edge distance between patches with netlogo

查看:137
本文介绍了带有netlogo的补丁之间的边到边距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用netlogo计算补丁之间的边到边距离?使用距离"功能,可以从色块中心计算色块之间的距离.

How can I compute edge to edge distance between patches with netlogo ? With the function "distance", distance between patches is calculated from center of patches.

非常感谢您的帮助. 祝你有美好的一天 海军陆战队

Thank you very much for your help. Have a good day Marine

推荐答案

如果要测量补丁边缘之间的距离,可以在补丁边缘上创建临时龟,并测量这些龟之间的距离.我假设您想要两个补丁边缘上任何两个点之间的最短距离.在这种情况下,您可以在每个斑块上创建8个海龟(四个角和四个中边缘点),并在任何一对海龟之间保持最小距离.

If you want to measure the distance between the edges of your patches, you can create temporary turtles on the edges of your patches and measure the distance between these turtles. I assume that you want the shortest distance between any two points located on the edges of your two patches. In this case, you can create 8 turtles on each patch (the four corners and the four mid-edge points) and take the minimum distance between any pair of turtles.

to-report create-edge-turtles [ p ]
  let edge-turtles nobody
  ask p [
    foreach sort neighbors [
      sprout 1 [
        face ?
        fd distance ? / 2
        set edge-turtles (turtle-set edge-turtles self)
      ]
    ]
  ]
  report edge-turtles
end

to-report edge-distance [ patch-a patch-b ]
  let edges-a create-edge-turtles patch-a
  let edges-b create-edge-turtles patch-b
  let result min [ min [ distance myself ] of edges-b ] of edges-a
  ask edges-a [ die ]
  ask edges-b [ die ]
  report result
end

这篇关于带有netlogo的补丁之间的边到边距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆