NetLogo banner

 Home
 Download
 Help
 Resources
 Extensions
 FAQ
 References
 Contact Us
 Donate

 Models:
 Library
 Community
 Modeling Commons

 User Manuals:
 Web
 Printable
 Chinese
 Czech
 Japanese

  Donate

NetLogo Models Library:
3D/Code Examples

(back to the library)

[screen shot]

Note: If you download the NetLogo application, every model in the Models Library is included.

WHAT IS IT?

This is a 3D version of the 2D model Neighborhoods Example This code example shows how to use the basic 2D and 3D neighborhood primitives in a 3D world. These include neighbors, neighbors6, in-radius, and at-points:

  • neighbors: reports the 26 patches surrounding a patch or turtle

  • neighbors6: reports the same patches, excluding the ones at the corners

  • <agentset> in-radius <number>: reports those agents in agentset whose distance from the caller is less than or equal to n.

  • <agentset> at-points <list>: reports those agents in agentset at the given points relative to the caller, where list is a list of two-element lists.

Although in this example, we only change the color of the reported patches, you can of course do more complicated operations, including assigning that agentset to a variable. This is particularly useful for Cellular Automata models.

(back to the NetLogo Models Library)