ostrat.pGrid
This package has been deprecated. It is being replaced by the prid package.
This package works with hexagonal and Square tile grids. The tile objects themselves will not in the general case the contain grid coordinates, although * it may be necessary to include this data for complex Tile values interacting with their wider environment. Its fundamental components are the grid data itself. This is just a linear array of tile data. Compile-time typed grid data. So for example a chess board can be represented by a 64 element Arr, its context determines that it is to be interpreted as an 8 by 8 square grid. Grid descriptions that describe the grid representation in the Array and GridFunctions which implement Cood to T. The grid and grid-gui hierarchies currently contain a mix of new and old systems. The package name pGrid was chosen to allow you to use the name "grid" in your code.
Type members
Classlikes
A Cood represents a 2 dimensional integer coordinate within a tile grid system. This has current been implemented for Hexs and Squares, while triangles is the third possible regular tile system. A SqGrid Cood represents either a tile centre, a tile side or a tile vertex. This is the same for a Hex Grid except that not all values are legal Cood values on a HexGrid. This system allows river and naval units to move along the tile sides. The axis are named xi and yi to distinguish them from the x and y of a Vec2. On a Hex grid there is not a simple 1 to 1 mapping between the Cood components and the Vec2 components.
A Cood represents a 2 dimensional integer coordinate within a tile grid system. This has current been implemented for Hexs and Squares, while triangles is the third possible regular tile system. A SqGrid Cood represents either a tile centre, a tile side or a tile vertex. This is the same for a Hex Grid except that not all values are legal Cood values on a HexGrid. This system allows river and naval units to move along the tile sides. The axis are named xi and yi to distinguish them from the x and y of a Vec2. On a Hex grid there is not a simple 1 to 1 mapping between the Cood components and the Vec2 components.
- Companion:
- object
A 2d line defined by its start and end Tile Cood.
A 2d line defined by its start and end Tile Cood.
- Companion:
- object
An Array[Int] based collection for CoodLines.
An Array[Int] based collection for CoodLines.
- Companion:
- object
An array[Int] based collection for Cood. To be replaced by prid.TileCoord.
An array[Int] based collection for Cood. To be replaced by prid.TileCoord.
- Companion:
- object
In a simple Grid the only GridElems are Tiles. In a complex grid, there are values for tiles and tile sides. For programmatic purposes it is vital that GridElem contains its grid coordinates, although at a logical level a tile does not need to know its position within the tile grid. It needs this information so it can communicate with its grid.
In a simple Grid the only GridElems are Tiles. In a complex grid, there are values for tiles and tile sides. For programmatic purposes it is vital that GridElem contains its grid coordinates, although at a logical level a tile does not need to know its position within the tile grid. It needs this information so it can communicate with its grid.
I've kept this file because some of the code may be useful
I've kept this file because some of the code may be useful
A Hex tile Step can take 6 values
A Hex tile Step can take 6 values
An optional hex tile step. Represents the relative move from a hex tile to one of its six neighbours or the non move value. It can be one of the 6 HTStep values or the HTStepNone value.
An optional hex tile step. Represents the relative move from a hex tile to one of its six neighbours or the non move value. It can be one of the 6 HTStep values or the HTStepNone value.
yDiv4Rem0 Up, DR, DL or yDiv4Rem2 UR, Dn, UL
yDiv4Rem0 Up, DR, DL or yDiv4Rem2 UR, Dn, UL
To be deprecated. A Hex tile own the right sides, upRight, Right and DownRight. It owns the Up, UpRight and DownRight Vertices numbers 0, 1 and 2.
To be deprecated. A Hex tile own the right sides, upRight, Right and DownRight. It owns the Up, UpRight and DownRight Vertices numbers 0, 1 and 2.
- Companion:
- object
This grid is irregular in the length of the Hex rows. The (0) value gives yTileMin. There are 2 more values for row. Each row from lowest to highest has two values the xMin for the row and the index into a data array for the first tile of the grid row. *
This grid is irregular in the length of the Hex rows. The (0) value gives yTileMin. There are 2 more values for row. Each row from lowest to highest has two values the xMin for the row and the index into a data array for the first tile of the grid row. *
- Value parameters:
- tileRowsStartEnd
the Array contains 2 values per Tile Row, the cStart Tile and the cEnd Tile
- yTileMin
The y value for the bottom tile row of the TileGrid
- Constructor:
creates a new HexGridIrr with a defined grid.
A grid of Hexs. The grid may be a regular rectangle of hexs or an irregular grid with variable length rows.
A grid of Hexs. The grid may be a regular rectangle of hexs or an irregular grid with variable length rows.
- Companion:
- object
- Companion:
- object
To be removed. Although including the cood could be considered to break the principle of encapsulation, A tile should not need to know where it is in a grid. I think it is necessary. Although the cood is determined by its position in the array there is just no good way for this data to be recovered by the Grid for random access. I think also it might be better to change to a var.
To be removed. Although including the cood could be considered to break the principle of encapsulation, A tile should not need to know where it is in a grid. I think it is necessary. Although the cood is determined by its position in the array there is just no good way for this data to be recovered by the Grid for random access. I think also it might be better to change to a var.
- Companion:
- object
I am happy with the fundamental concept behind the OfTile traits, documentation later
I am happy with the fundamental concept behind the OfTile traits, documentation later
A Roord Row-ordinate represents a 2 dimensional integer coordinate within a tile grid system. The row or y value comes first. This is different to a Vec2 or Vec3 where the y vlue comes 2nd after the x valu. This has current been implemented for Hexs and Squares, while triangles is the third possible regular tile system. A SqGrid Cood represents either a tile centre, a tile side or a tile vertex. This is the same for a Hex Grid except that not all values are legal Cood values on a HexGrid. This system allows river and naval units to move along the tile sides. The axis are named y and c to distinguish them from the x and y of a Vec2. On a Hex grid there is not a simple 1 to 1 mapping between the Cood components and the Vec2 components.
A Roord Row-ordinate represents a 2 dimensional integer coordinate within a tile grid system. The row or y value comes first. This is different to a Vec2 or Vec3 where the y vlue comes 2nd after the x valu. This has current been implemented for Hexs and Squares, while triangles is the third possible regular tile system. A SqGrid Cood represents either a tile centre, a tile side or a tile vertex. This is the same for a Hex Grid except that not all values are legal Cood values on a HexGrid. This system allows river and naval units to move along the tile sides. The axis are named y and c to distinguish them from the x and y of a Vec2. On a Hex grid there is not a simple 1 to 1 mapping between the Cood components and the Vec2 components.
- Companion:
- object
A 2d line defined by its start and end TileGrid Roord.
A 2d line defined by its start and end TileGrid Roord.
- Companion:
- object
An Array[Int] based collection for RoordLines.
An Array[Int] based collection for RoordLines.
- Companion:
- object
A deci-Roordinate. Divides the line between 2 Roords into graduations of ten. Defines the point a certain number of tenths toward the second Roord.
A deci-Roordinate. Divides the line between 2 Roords into graduations of ten. Defines the point a certain number of tenths toward the second Roord.
- Companion:
- object
- Companion:
- object
I've kept this file because some code might be useful
I've kept this file because some code might be useful
- Companion:
- object
Currently all SquareGrids are regular.
Currently all SquareGrids are regular.
- Companion:
- object
Currently all SquareGrids are regular.
Currently all SquareGrids are regular.
- Companion:
- object
An immutable Arr of Boolean Tile data for a specific TileGrid. This is specialised for Boolean. The tileGrid can map the Roord of the Tile to the index of the Arr. Hence most methods take an implicit TIleGrid parameter.
An immutable Arr of Boolean Tile data for a specific TileGrid. This is specialised for Boolean. The tileGrid can map the Roord of the Tile to the index of the Arr. Hence most methods take an implicit TIleGrid parameter.
A Tile grid that contains both values for the tiles and the tile boundaries or sides. Rivers, straits, walls, doors, windows ditches and fortifications are examples of values commonly assigned to tile sides.
A Tile grid that contains both values for the tiles and the tile boundaries or sides. Rivers, straits, walls, doors, windows ditches and fortifications are examples of values commonly assigned to tile sides.
A tileGrid is a collection of tiles, either hexs or squares. This is a fundamental trait. It is a specific case of a tiled area. I have reached the conclusion that the general case of completely irregular tiling, while interesting mathematically and useful for say representing a historical game like "Risk", has insufficient utility for the representations we want today. Tile rids can however be fully regular or partly irregular such as the grids for covering the Earth's surface. Grids can be simple just consisting of values for the tiles or complex containing values for the tiles and the tile sides. Rivers, straits, walls, ditches are examples of values commonly assigned to tile sides.
It is stored in an underlying array. It consists of a sequence of contiguous rows of tiles. Each row of tiles is itself contiguous, There are no breaks between the first tile of the row and the last tile of the row although a row can consist of a single tile. Every row shares at least one tile side with the row above and below. The grid includes all the sides of the tiles including the sides on the outer edges of the grid. This means to link two grids requires a Grid Bridge class.
A TileGrid is a description of an abstract TileGrid. It contains no data for the elements of any particular TileGrid. The Data for TileGrids is stored in flat arrays. The TileGrid gives the dimensions of a tileGrid. It has methods to interpret the data in flat Arrays created for that TileGrid specification. It has methods to map the elements of an Array to the the 2 dimensional geometry of the Tile Grid. On its own a TileGrid can produce the outlines of the grid, coordinates vector positions and other pure mathematical data. Combined with a simple function it can for example produce a Chess board. Combined with a 64 length array it can produce a Chess board position. For anything but the most simple games, you will probably want multiple arrays to describe the game state. The terrain for example may remain invariant, so the terrain data does not need to be reproduced with every move.
A TileGrid is a description of an abstract TileGrid. It contains no data for the elements of any particular TileGrid. The Data for TileGrids is stored in flat arrays. The TileGrid gives the dimensions of a tileGrid. It has methods to interpret the data in flat Arrays created for that TileGrid specification. It has methods to map the elements of an Array to the the 2 dimensional geometry of the Tile Grid. On its own a TileGrid can produce the outlines of the grid, coordinates vector positions and other pure mathematical data. Combined with a simple function it can for example produce a Chess board. Combined with a 64 length array it can produce a Chess board position. For anything but the most simple games, you will probably want multiple arrays to describe the game state. The terrain for example may remain invariant, so the terrain data does not need to be reproduced with every move.
A TileGrid is for use cases where the proportions of the Grid predetermine the proportions of the visual representation, as opposed to a use case where the proportions of the enclosing space are a factor in determining the proportions of the grid. For example the various grid layouts of the Stars on the American flag.
- Companion:
- object
An immutable Arr of Tile data for a specific TileGrid. This is specialised for AnyRef types The tileGrid can map the Roord of the Tile to the index of the Arr. Hence most methods take an implicit TIleGrid parameter.
An immutable Arr of Tile data for a specific TileGrid. This is specialised for AnyRef types The tileGrid can map the Roord of the Tile to the index of the Arr. Hence most methods take an implicit TIleGrid parameter.
- Companion:
- object
An immutable Arr of Opt Tile data for a specific TileGrid. This is specialised for OptRef[A]. The tileGrid can map the Roord of the Tile to the index of the Arr. Hence most methods take an implicit TileGrid parameter.
An immutable Arr of Opt Tile data for a specific TileGrid. This is specialised for OptRef[A]. The tileGrid can map the Roord of the Tile to the index of the Arr. Hence most methods take an implicit TileGrid parameter.
Not sure about the use of List in this class.
Not sure about the use of List in this class.