我目前正在使用Netlogo3d建模一些简单的boid,并且在锥内和半径内函数存在问题。
((我正在重新实现Couzin,Krause,James,Ruxton和Franks的文章“动物群中的集体记忆和空间分类”)
我使用两个不同的区域来定义其行为:一种用于排斥,一种用于吸引,另一种用于定向。那些三是围绕着博伊德球体Thoses areas look like this我正在这样的区域中检测到乌龟:
to find-flockmates-repulsion ;; turtle procedure
set flockmatesRepulsion other turtles in-cone (visionRepulsion * scale) fov
end
to find-flockmates-orientation ;; turtle procedure
set flockmatesOrientation other turtles in-cone ((visionOrientation + visionRepulsion) * scale) fov
end
to find-flockmates-attraction ;; turtle procedure a modifier pour enlever les turtles dans le radius visionOrientation
set flockmatesAttraction other turtles in-cone ((visionAttraction + visionOrientation + visionRepulsion) * scale) fov
end
但是这三个区域是重叠的,我不希望它们重叠。
有没有一种方法可以减少对圆锥形和半径函数的选择,如:
set flockmatesAttraction other turtles [ (in-cone ((visionAttraction + visionOrientation + visionRepulsion) * scale) fov) and not (in-cone ((visionOrientation + visionRepulsion) * scale) fov) ]
如果可能的话,不要在2个列表上循环,我试图使我的辫子有效谢谢!
((PS:对不起,英语不好)
而不是发现圆锥形的修改(我认为这样做是有效的,您可以像在问题中那样简单地计算三个座席集,然后从较大的座席集中删除较小的座席集。获得差异代理集,这就是您要追求的。
所以您会这样做:
to find-flockmates-repulsion ;; turtle procedure
set flockmatesRepulsion other turtles in-cone (visionRepulsion * scale) fov
end
to find-flockmates-orientation ;; turtle procedure
set flockmatesOrientation other turtles in-cone ((visionOrientation + visionRepulsion) * scale) fov
end
to find-flockmates-attraction ;; turtle procedure a modifier pour enlever les turtles dans le radius visionOrientation
set flockmatesAttraction other turtles in-cone ((visionAttraction + visionOrientation + visionRepulsion) * scale) fov
end
;; and then remove the overlap using the member? reporter
set flockmatesAttraction flockmatesAttraction with [not member? self flockmatesOrientation ]
通过我使用查尔斯(Charles)发表的关于如何从另一个代理中减去一个代理集的答案Removing an agentset from another agentset (the agents from the first set which are also present in the second set)其中他说:
我认为您想要的是成员?原始。如果D和B是代理集,以下应为您提供非D的成员B的成员。
将DminusB D与[不是成员?自我B]