Home Download Help Resources Extensions FAQ NetLogo Publications Contact Us Donate Models: Library Community Modeling Commons User Manuals: Web Printable Chinese Czech Farsi / Persian Japanese Spanish

NetLogo Models Library:

Note: If you download the NetLogo application, every model in the Models Library is included. 
This model is a 3D version of a surfacewalking algorithm used in "Surface Walk 2D". Turtles approximate a userdefined surface using a simple algorithm that considers the turtle's current position relative to neighboring surface patches.
Turtles exist in a world that consists of two different kinds of patches: surface and nonsurface. Turtles follow two basic rules in order to walk along the patchdefined surface:
1) Look for opposite neighboring patches. If the turtle is currently on a surface patch, it will look for a nonsurface one, and vice versa. 2) Of those neighboring patches of opposite type, identify the one that requires the smallest change in turtle angle for the turtle to face. 3) Adjust pitch and heading halfway to the patch that requires the smallest change in angle to face and take a step.
Why does this algorithm work? Consider any perturbation along a flat surface (in the case of 2D, a curve or angle along an otherwise straight line). In order to traverse the perturbation and remain on the surface, a turtle needs to find and remain on the 'edge' of the surface, and maintain its direction while traveling along this edge. Since turtles in NetLogo always report being on only one patch (the one that the center of their body is over), we maintain the turtle's position along the edge by having it search for a patch that is of opposite type to the patch it is positioned over (Rule 1).
Rule 2 enables the turtles to travel along that edge while maintaining their current direction. Consider a surface in 2D: turtles are able to travel along that surface in one of two opposite directions (for example, they can walk along a circle in either a clockwise or counterclockwise direction). If a surface is flat, a turtle need not change its heading at all to continue to travel in the same direction along that surface. But, if the surface is curved or has an angle, then in order to continue to stay along the edge of the surface the turtle must change its heading. If it changes its heading exactly 180 degrees, it will reverse its direction of travel. But whether the angle is concave or convex, it will be of some measure between 0 and 360 degrees (noninclusive). Then the heading change required to continue along the surface without reversing the direction of travel will be less than that required to reverse direction.
Finally, Rule 3 reduces the 'weaving' effects produced by turtles moving toward surface and nonsurface patches in order to remain close to the edge by having turtles actually point only halfway to the patch of interest.
In 3D versions of this surfacewalking algorithm, the same rules are used as in the 2D version, but the way to determine the angle between a turtle's current heading and the nearest opposite patch is a little more complicated. Because there are two angle measures, heading and pitch, we use the inverse dot product to determine the angle between a turtle's heading and a given patch. For more detail, it may help to look through the "Trig for Angle Calculations" section of the Code tab or visit the "Geometric Interpretation" of the dot product entry at Wikipedia: https://en.wikipedia.org/wiki/Dot_product.
NUMBEROFTURTLES: Allows the user to adjust the number of turtles that will appear along the shape surface when SETUP is pressed. STEPSIZE: Allows the user to adjust how far each turtle moves forward during each step. SURFACESHAPE: Allows the user to select the surface shape to appear when SETUP is pressed. COLOREDSURFACE?: Allows user to toggle whether the surface on which turtles will walk is colored red, or is invisible. SETUP: Sets up the environment by creating a surface and placing turtles along the surface. GO: Runs the model by asking turtles to walk along the surface. TRACE: Asks a random turtle to leave a trail.
Try adjusting STEPSIZE while the model is running. What happens to the motion of the turtles? What happens to their speed?
Do turtles behave differently on different types of surfaces? Try using the SURFACESHAPE chooser to test different shapes. Try creating your own.
Set the SURFACESHAPE chooser to "Sphere", and set NUMBEROFTURTLES to 1. Run the model and observe the motion of that one turtle over the sphere. Is its motion what you would expect? Try using the TRACE button to trace the turtle's trajectory over the surface, or try different surfaces.
What might happen if the STEPSIZE is set to 1 or larger?
Currently, turtles turn half of the way to the edge patch that they identify. What happens if they turn the whole way?
Select "Mickey Mouse" from the SURFACESHAPE chooser. SETUP and tell the model to GO. What happens to turtles when they pass over the acute angles where Mickey's ears meet his head? Try adjusting the STEPSIZE slider while the model is running to investigate.
When does the surfacewalking algorithm fail? Why? Does changing the world's resolution effect turtle motion?
Currently, turtles seek the surface edge by seeking patches that are classified in certain ways. Find and implement another way that patches can be identified or that turtles can identify edge patches.
Can there be more than two types or classifications of surface patches? When would this be useful?
Try using stamp
to trace the trajectory of a turtle over different kids of surfaces. How might one describe surfacewalking accuracy?
The surfacewalking algorithm used in this model fails for surfaces (or gaps in surfaces) that are only one patch wide. Why? How might this be fixed?
Note the use of towards
and towardspitch
to compute headings and pitches and minoneof
to make a choice between competing patches.
Surface Walking (2D NetLogo model)
If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.
For the model itself:
Please cite the NetLogo software as:
Copyright 2007 Uri Wilensky.
This work is licensed under the Creative Commons AttributionNonCommercialShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/byncsa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.
This is a 3D version of the 2D model Surface Walking.
(back to the NetLogo Models Library)