Show / Hide Table of Contents

Interface IGrid

Represents a arrangement of cells, including their adjacency and locations. Cells are uniquely identified by a Vector3Int. Tessera.IGrid is roughly equivalent to DeBroglie.Topo.ITopology.

Namespace: Tessera
Assembly: cs.temp.dll.dll
Syntax
public interface IGrid

Properties

CellType

Describes what sort of cell can be found in this grid

Declaration
ICellType CellType { get; }
Property Value
Type Description
ICellType

IndexCount

Finds a number one larger than the maximum index for an in bounds cell.

Declaration
int IndexCount { get; }
Property Value
Type Description
Int32

Methods

FindCell(Vector3, Matrix4x4, out Vector3Int, out CellRotation)

Returns the cell and rotation for a tile placed in the grid. NB: If you pass TesseraTileBase.center as the center, the cell returned corresponds to offset (0,0,0). The tile may not actually occupy that offset.

Declaration
bool FindCell(Vector3 tileCenter, Matrix4x4 tileLocalToGridMatrix, out Vector3Int cell, out CellRotation rotation)
Parameters
Type Name Description
Vector3 tileCenter
Matrix4x4 tileLocalToGridMatrix
Vector3Int cell
CellRotation rotation
Returns
Type Description
Boolean

FindCell(Vector3, out Vector3Int)

Finds the cell containg the give position

Declaration
bool FindCell(Vector3 position, out Vector3Int cell)
Parameters
Type Name Description
Vector3 position
Vector3Int cell
Returns
Type Description
Boolean

GetBoundsSymmetries(Boolean, Boolean, RotationGroupType)

Declaration
IEnumerable<(GridSymmetry, Vector3Int)> GetBoundsSymmetries(bool rotatable = true, bool reflectable = true, RotationGroupType rotationGroupType = RotationGroupType.All)
Parameters
Type Name Description
Boolean rotatable
Boolean reflectable
RotationGroupType rotationGroupType
Returns
Type Description
IEnumerable<ValueTuple<GridSymmetry, Vector3Int>>

GetCell(Int32)

Finds the cell associated with a given index.

Declaration
Vector3Int GetCell(int index)
Parameters
Type Name Description
Int32 index
Returns
Type Description
Vector3Int

GetCellCenter(Vector3Int)

Returns the center of the cell in local space

Declaration
Vector3 GetCellCenter(Vector3Int cell)
Parameters
Type Name Description
Vector3Int cell
Returns
Type Description
Vector3

GetCells()

Gets a full list of cells in bounds.

Declaration
IEnumerable<Vector3Int> GetCells()
Returns
Type Description
IEnumerable<Vector3Int>

GetCellsIntersectsApprox(Bounds, Boolean)

Gets the set of cells that potentially overlap bounds.

Declaration
IEnumerable<Vector3Int> GetCellsIntersectsApprox(Bounds bounds, bool useBounds)
Parameters
Type Name Description
Bounds bounds
Boolean useBounds
Returns
Type Description
IEnumerable<Vector3Int>

GetIndex(Vector3Int)

Finds the index associated with a given cell. Cell must be in bounds.

Declaration
int GetIndex(Vector3Int cell)
Parameters
Type Name Description
Vector3Int cell
Returns
Type Description
Int32

GetMoveRotations()

Returns the full set of rotations that TryMove can output. Can just default to CellType.GetRotations();

Declaration
IEnumerable<CellRotation> GetMoveRotations()
Returns
Type Description
IEnumerable<CellRotation>

GetTRS(Vector3Int)

Returns the appropriate transform for the cell. The translation will always be to GetCellCenter. Not inclusive of cell rotation, that should be applied first.

Declaration
TRS GetTRS(Vector3Int cell)
Parameters
Type Name Description
Vector3Int cell
Returns
Type Description
TRS

GetValidFaceDirs(Vector3Int)

Returns directions we might expect TryMove to work for (though it is not guaranteed). This is mostly useful for heterogenous grids where not every cell is identical.

Declaration
IEnumerable<CellFaceDir> GetValidFaceDirs(Vector3Int cell)
Parameters
Type Name Description
Vector3Int cell
Returns
Type Description
IEnumerable<CellFaceDir>

InBounds(Vector3Int)

Returns true if the cell is actually in the size specified. Some grids support out of bounds cells, in which case operations like TryMove may need to be filtered.

Declaration
bool InBounds(Vector3Int cell)
Parameters
Type Name Description
Vector3Int cell
Returns
Type Description
Boolean

TryApplySymmetry(GridSymmetry, Vector3Int, out Vector3Int, out CellRotation)

Declaration
bool TryApplySymmetry(GridSymmetry s, Vector3Int cell, out Vector3Int dest, out CellRotation r)
Parameters
Type Name Description
GridSymmetry s
Vector3Int cell
Vector3Int dest
CellRotation r
Returns
Type Description
Boolean

TryMove(Vector3Int, CellFaceDir, out Vector3Int, out CellFaceDir, out CellRotation)

Attempts to move from a face in a given direction, and returns information about the move if successful. Note that for some grids, this can succeed, and return a cell outside of bounds.

Declaration
bool TryMove(Vector3Int cell, CellFaceDir faceDir, out Vector3Int dest, out CellFaceDir inverseFaceDir, out CellRotation rotation)
Parameters
Type Name Description
Vector3Int cell
CellFaceDir faceDir
Vector3Int dest
CellFaceDir inverseFaceDir
CellRotation rotation
Returns
Type Description
Boolean

TryMoveByOffset(Vector3Int, Vector3Int, Vector3Int, CellRotation, out Vector3Int, out CellRotation)

Maps between cell offsets and cells in the grid. This could be done with FindPath(Vector3Int, Vector3Int), but this can be more efficient.

Declaration
bool TryMoveByOffset(Vector3Int startCell, Vector3Int startOffset, Vector3Int destOffset, CellRotation startRotation, out Vector3Int destCell, out CellRotation destRotation)
Parameters
Type Name Description
Vector3Int startCell
Vector3Int startOffset
Vector3Int destOffset
CellRotation startRotation
Vector3Int destCell
CellRotation destRotation
Returns
Type Description
Boolean
Back to top Generated by DocFX