swarm-modeling
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

measuring distance in grids


From: Paul E Johnson
Subject: measuring distance in grids
Date: Fri, 11 Jan 2002 13:44:52 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.5) Gecko/20011014

I have a project where agents are in a grid and it is important to measure distance. The authors of the original article I'm replicating do not define a distance metric, but I originally assumed the distance was Euclidean. That is, I guessed the distance between x=(x1,x2) and y=(y1,y2) would be measured

dist = sqrt[ (x1-y1)*(x1-y1)+(x2-y2)*(x2-y2) ]

but I get some funny results using that, and I'm starting to wonder what other metrics people might think are standard on a rectangular grid.

One I'm considering is "radial square" distance, where distance is the radius of the square centered on a point that touches another point. That means the distance from a cell to all immediate Moore neighbors is 1, and for the next larger neighborhood, the distance would be 2. See what I mean? Here, the distance from the center point 0 to a neighbor is:
           3333333
           3222223
           3211123
           3210123
           3211123
           3222223
           3333333

Does anybody have an opinion?
--
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700



                 ==================================
  Swarm-Modelling is for discussion of Simulation and Modelling techniques
  esp. using Swarm.  For list administration needs (esp. [un]subscribing),
  please send a message to <address@hidden> with "help" in the
  body of the message.
                 ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]