8/3/2023 0 Comments Reporter netlogoAssumptions: - All turtles are centered on a cell, otherwise it won't work - worldWidth is even, so that the cells wraps properly (imposed by slider) - xHeight is even, so that cell centres are integral pixels (imposed by slider) PROCEDURE and VARIABLE USAGE setup xDx * ?1 ] xDx of xNeighbors, listed by xHeading. COPYRIGHT AND LICENSEīy Ian J Heath is licensed under a Creative Commons Attribution 4.0 International License Partly based on Uri Wilensky's "Hex Cells Example" in the Models Library. This uses the distorted hexagonal grid, also modeled here for comparison purposes. To demonstrate this the TrueHex switch allows the use of either undistorted or distorted hexagonal grids. Only the setup-hex-grid procedure is dependent upon whether the grid geometry is truly hexagonal. Each new hex is created on top of the others and hides those below (until it is deleted or dragged away). Multiple hexes can be created on the same cell. The Interface tab has mouse and "Action key" combinations to create them, select them, recolor them, drag and drop them between cells, and delete them. To demonstrate the use of manipilation of hexes, we define hex turtles to fit into cells exactly. The model allows for the World to have none-wrapping boundaries, and even for the grid to have holes in it (provided 'no cell is an island'). They do a (mostly straight) random walk, bouncing off any non-wrapping boundary. Use of this navigation is exemplified by the walk procedure in which walkers are centred on cells and navigate the grid by stepping to an immediate neighbor cell. In order to conform with this avoidance of using patches, navigation around the grid uses xNeighbor-reporter which reports the neighboring cell in the specified direction. For example, selected-cell-reporter reports the cell under the mouse, with no reference to patches. The user parameters are constained so that the hex grid wraps exactly, and the World origin is set to the bottom-left corner as there must be an even number of patches on each axis.Īfter setup, cells are used instead of patches (with the sole exception of inside the xNeighbor-reporter). Setup resizes the World (according to the user parameters) and creates the hex grid. Instead we use pixel patches that are pixels (with patch size = 1) and create truly hexagonal cells (a breed of turtles) to form the grid. To achieve an undistorted hexagonal grid, the grid is not based on patches the same height as the cells (as in Uri Wilensky's "Hex Cells Example") because such a grid must be squashed vertically by a factor of 0.866. This demonstrates how to make a model that uses an undistorted hexagonal grid of cells. Do you have questions or comments about this model?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |