Netlogo 海龟与斑块夹角的计算

Netlogo 海龟与斑块夹角的计算,netlogo,Netlogo,如何计算图中规定的上述角度。 补丁是事先知道的。 我不会为它编写代码,但这里有一个通用配方: 通过和加/减0.5,找到面片的四个角点 通过使用查找最近的两个角 通过使用找到这两点中每一点的标题 使用计算这两个标题之间的差异 to-report calculate-turtles-in-cone2 let px [pxcor] of patch-goal let py [pycor] of patch-goal ; show [pxcor] of patch-goal set

如何计算图中规定的上述角度。 补丁是事先知道的。

我不会为它编写代码,但这里有一个通用配方:

  • 通过和加/减0.5,找到面片的四个角点
  • 通过使用查找最近的两个角
  • 通过使用找到这两点中每一点的标题
  • 使用计算这两个标题之间的差异
to-report calculate-turtles-in-cone2
  let px [pxcor] of patch-goal
  let py [pycor] of patch-goal
 ; show  [pxcor] of patch-goal
  set corner-1 list (px + 0.5 - .25)(py - 0.5)
  set corner-2 list (px - 0.5 + .25)(py - 0.5)
; show corner-1 
; show corner-2
  let head-1 towardsxy (item 0 corner-1) (item 1 corner-1)
  let head-2 towardsxy (item 0 corner-2) (item 1 corner-2)
  report abs (subtract-headings head-1 head-2)  
end