NetLogo banner

Home
Download
Help
Forum
Resources
Extensions
FAQ
NetLogo Publications
Contact Us
Donate

Models:
Library
Community
Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Web
Printable
Chinese
Czech
Farsi / Persian
Japanese
Spanish

  Donate

NetLogo Models Library:
Code Examples/Extensions Examples/view2.5d

(back to the library)

2.5d Turtle View Example

[screen shot]

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

WHAT IS IT?

This example demonstrates the use of the view2.5d extension for turtle views. The view2.5d extension allows properties of turtles to be visualized using their height and stem color.

This example also shows how links between turtles can be visualized in three dimensions.

The model opens a separate "Turtle View" window by calling:

view2.5d:turtle-view window-name turtles [ the-turtle -> [height] of the-turtle ]

The anonymous reporter supplied to the view2.5d:turtle-view primitive is used by the extension to set the height of each turtle.

The anonymous reporter supplied to the view2.5d:set-turtle-stem-color primitive is used by the extension to set the stem color of each turtle.

The method view2.5d:set-turtle-stem-thickness is used to set the stem color of each turtle.

In the go procedure, we use view2.5d:update-turtle-view to refresh the turtle view using the current state of the model.

Several extension-specific methods are used to control the three dimensional visualization of this "Turtle View":

  • view2.5d:set-observer-distance sets the observer's distance from its "focus point."

  • view2.5d:set-observer-heading sets the heading of the observer's angular perspective.

  • view2.5d:set-observer-pitch sets the pitch of the the observer's angular perspective.

  • view2.5d:set-observer-x-focus sets the x coordinate the observer is "looking at" in the patch plane.

  • view2.5d:set-observer-y-focus sets the y coordinate the observer is "looking at" in the patch plane.

  • view2.5d:set-z-scale sets the scale of the z-axis, in this case making the turtles "taller".

For more information, please refer to the view2.5d extension documentation.

HOW IT WORKS

At each tick the height and turtle stem color are changed based on properties of the turtles within a small radius.

The height is changed by the difference between a turtle's height and the average height of its near neighbors (if any). That means if a turtle is at a lower height than the average of its neighbors, its height will increase, and if a turtle's height is higher than the average of its neighbors, its height will decrease.

The stem color is changed to the average stem color of its near neighbors (if any).

The turtle takes on the color of its stem.

HOW TO USE IT

The model has standard SETUP and GO buttons.

The NUM-TURTLES slider determines the initial number of turtles.

The link related interface items take effect at the next tick.

The links are visible when the SHOW-LINKS? switch is set to ON, and invisible if it is set to OFF.

There is a chooser to chose the LINK-COLOR.

A slider is used to set the LINK-THICKNESS. Note that the thickness appears much larger in the small 2D inset.

THINGS TO TRY

Use the NUM-TURTLES slider to explore how increasing or decreasing the number of turtles affects how quickly the height and stem color of the turtles changes.

Use the switch, chooser, or slider to instantaneously change the visualization of links.

In the 3D window, explore the effect of the different View Options by selecting different combinations of check boxes and switching between Link Options by using radio buttons.

Note that links are shown using the 3D option by default. To programmatically start a model with links shown in 2D, add the following line

view2.5d:show-links-xy-plane window-name after the line with the view2.5d:turtle-view command.

RELATED MODELS

  • 2.5d Patch View Example

(back to the NetLogo Models Library)