Patches have coordinates, and the origin is always (0,0). With NetLogo, you can specify the world's origin; it can be at the center, upper left, upper right, bottom left, or bottom right. For the sample image below, the origin can be set to (0,0), (-2,2), (-2,-2) or (2,-2).
Origin position options |
pxcor
and pycor
variables hold the x
and y
coordinates of the patch. These values are always integers, unlike turtle's coordinates, which can take decimals. Also, unlike turtle's coordinates, these variables cannot be modified because patches don't change locations. The max-pxcor
and max-pycor
variables hold values corresponding to the maximum x-coordinate and maximum y-coordinate for patches. Similarly, min-pxcor
and min-pycor
hold the minimum x-coordinate and minimum y-coordinate for patches. Both pxcor
and pycor
should be within the range of these values. Like turtles, patch colors can be set or modified via
pcolor
variable. A color can either be a single number or an RGB color. Plabel
stores a value of any type, which can be attached to a patch. Plabel-color
holds a number from 0 to 139, which determines the color of the patch's label. Plabel-color can be set or altered like the variables.
All patch variables can be directly accessed by any turtle standing on the patch.
0 comments:
Post a Comment