2013-04-14 109 views
1

我已经使用面对在NetLogo没有任何问题,但不是只是一样吗? (在朝向贴片/剂的方向上对置的试剂的上下文中)面对和朝向有什么区别?

towards 

towards agent 


Reports the heading from this agent to the given agent. 

If wrapping is allowed by the topology and the wrapped distance (around the edges of the world) is shorter,  towards will use the wrapped path. 

Note: asking for the heading from an agent to itself, or an agent on the same location, will cause a runtime error. 

set heading towards turtle 1 
;; same as "face turtle 1" 
See also face. 

是否有其中使用设置朝向标题比使用更好任何情形?

回答

2

在某些情况下,您想知道标题朝向什么东西而不真正面对它吗?我相信你可以想到很多。一个示例情况是根据一些标准在两个可能的标题之间进行选择。

比方说,你要面对两个代理商之一,哪一个要求打开最少的:

let first-heading towards first-agent 
let second-heading towards second-agent 

; compare my current heading to the two calculated headings: 
let first-angle subtract-headings heading first-heading 
let second-angle subtract-headings heading second-heading 

if-else abs first-angle < abs second-angle 
    [ rt first-angle ] 
    [ rt second-angle ] 

(在现实生活中,你可能会做的事情有点不同,但我希望这带着点。)

+0

我明白了。我被固定在“朝向......”的“朝着...”的用法上,这就是为什么我一直将其与“正面”进行比较的原因。我现在明白了。谢谢! – Gannicus