Loading ...
Sorry, an error occurred while loading the content.

Re: movement directions of agents

Expand Messages
  • andreko42
    Seth and James! Thank you very much for your help! The new code is working properly. The background of my idea is that points are the centroids of voronoi
    Message 1 of 4 , Feb 2, 2009
    • 0 Attachment
      Seth and James!

      Thank you very much for your help! The new code is working properly.
      The background of my idea is that 'points' are the centroids of
      voronoi polygons; they generate four or eight new mobile points
      (secpoints) in order to create new borderline points between two
      polygons. The result of this fine-tuning process is a new voronoi
      diagram with a better interpolation.

      thanks, andreas

      --- In netlogo-users@yahoogroups.com, Seth Tisue <seth@...> wrote:
      >
      > >>>>> "andreko42" == andreko42 <andreko42@...> writes:
      >
      > andreko42> Hello! I wish to implement a procedure which enables
      agents
      > andreko42> moving to four and eight directions, respectively (von
      > andreko42> Neumann or Moore neighborhood). My idea is as follow (to
      > andreko42> move to Nortn, East, South and West):
      >
      > andreko42> ask points [hatch-points 4 [set breed secpoints]] let
      > andreko42> factor 0 ask secpoints [set heading (factor * 90) set
      factor
      > andreko42> factor + 1]
      >
      > andreko42> In fact, there is often an overlay of two or three
      agent,
      > andreko42> moving to the same direction. What can I do, that each
      agent
      > andreko42> is walking to only one of the four directions?
      >
      > If I understand correctly what you're trying to do, you need to
      change
      > your code around a little, as follows:
      >
      > ask points [
      > let factor 0
      > hatch-secpoints 4 [
      > set heading (factor * 90)
      > set factor factor + 1
      > ]
      > ]
      >
      > In the new code, each group of 4 secpoints has its own "factor"
      > variable, instead of a single factor variable being shared by
      > all of the secpoints in the world.
      >
      > You could also do:
      >
      > ask points [
      > foreach n-values 4 [? * 90] [
      > hatch-secpoints 1 [ set heading ? ]
      > ]
      > ]
      >
      > I also like the approach James Steiner suggested.
      >
      > --
      > Seth Tisue / http://tisue.net
      > lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.