Show / Hide Table of Contents

Interface ICellType

An ICellType gives summarized info about a single cell in isolation of the grid it comes from. ICellType allows you to enumerate the edges/faces/corners of a cell, and work with cell symmetries (called CellRotation).

ICellType's are always singletons, e.g. SquareCellType.Instance is used for all square cells.

Note that cells can share an cell type, even if they are different shapes. Thus any methods that refer to positions, such as GetMatrix, don't refer to the specific cell in the grid, but the "canonical" cell. You must use IGrid methods like GetPolygon or GetDeformation to get the shape of a specific cell.

The canonical cell is usually a regular polygon or polyhedron of unit size centered on the origin. See the docs for more details

Namespace: Sylves
Assembly: Sylves.dll
Syntax
public interface ICellType

Properties

RotateCCW

Declaration
CellRotation RotateCCW { get; }
Property Value
Type Description
CellRotation

RotateCW

Declaration
CellRotation RotateCW { get; }
Property Value
Type Description
CellRotation

Methods

Format(CellCorner)

Declaration
string Format(CellCorner corner)
Parameters
Type Name Description
CellCorner corner
Returns
Type Description
System.String

Format(CellDir)

Declaration
string Format(CellDir dir)
Parameters
Type Name Description
CellDir dir
Returns
Type Description
System.String

Format(CellRotation)

Declaration
string Format(CellRotation rotation)
Parameters
Type Name Description
CellRotation rotation
Returns
Type Description
System.String

GetCellCorners()

Gets all the CellCorner used by this cell type.

Declaration
IEnumerable<CellCorner> GetCellCorners()
Returns
Type Description
System.Collections.Generic.IEnumerable<CellCorner>

GetCellDirs()

Gets all the CellDir used by this cell type.

Declaration
IEnumerable<CellDir> GetCellDirs()
Returns
Type Description
System.Collections.Generic.IEnumerable<CellDir>

GetCornerPosition(CellCorner)

Returns the position of a given corner in the canonical cell shape.

Note: This method describes the canonical cell shape, but many shapes of cell might reference this cell type.

Declaration
Vector3 GetCornerPosition(CellCorner corner)
Parameters
Type Name Description
CellCorner corner
Returns
Type Description
Vector3

GetIdentity()

Returns the rotation that leaves everything unchanged

Declaration
CellRotation GetIdentity()
Returns
Type Description
CellRotation

GetMatrix(CellRotation)

Returns the matrix a given rotation corresponds to.

Note: This method works for the canonical cell shape, but many shapes of cell might reference this cell type.

Declaration
Matrix4x4 GetMatrix(CellRotation cellRotation)
Parameters
Type Name Description
CellRotation cellRotation
Returns
Type Description
Matrix4x4

GetRotations(Boolean)

Gets all possible rotations of this cell type.

Declaration
IList<CellRotation> GetRotations(bool includeReflections = false)
Parameters
Type Name Description
System.Boolean includeReflections
Returns
Type Description
System.Collections.Generic.IList<CellRotation>

Invert(CellDir)

Returns the dir pointing in the opposite direction, if it exists.

Declaration
Nullable<CellDir> Invert(CellDir dir)
Parameters
Type Name Description
CellDir dir
Returns
Type Description
System.Nullable<CellDir>

Invert(CellRotation)

Gets the inverse rotation. i.e. GetIdentity() == Multiply(a, Invert(a)) == Multiply(Invert(a), a)

Declaration
CellRotation Invert(CellRotation a)
Parameters
Type Name Description
CellRotation a
Returns
Type Description
CellRotation

Multiply(CellRotation, CellRotation)

Composes two rotations/reflections together, doing b first, then a.

Declaration
CellRotation Multiply(CellRotation a, CellRotation b)
Parameters
Type Name Description
CellRotation a
CellRotation b
Returns
Type Description
CellRotation

Rotate(CellCorner, CellRotation)

Declaration
CellCorner Rotate(CellCorner dir, CellRotation rotation)
Parameters
Type Name Description
CellCorner dir
CellRotation rotation
Returns
Type Description
CellCorner

Rotate(CellDir, CellRotation)

Rotates a dir by the given rotation.

Declaration
CellDir Rotate(CellDir dir, CellRotation rotation)
Parameters
Type Name Description
CellDir dir
CellRotation rotation
Returns
Type Description
CellDir

Rotate(CellDir, CellRotation, out CellDir, out Connection)

Declaration
void Rotate(CellDir dir, CellRotation rotation, out CellDir resultDir, out Connection connection)
Parameters
Type Name Description
CellDir dir
CellRotation rotation
CellDir resultDir
Connection connection

TryGetRotation(CellDir, CellDir, Connection, out CellRotation)

Inverse of Rotate(CellDir, CellRotation, out CellDir, out Connection)

Declaration
bool TryGetRotation(CellDir fromDir, CellDir toDir, Connection connection, out CellRotation cellRotation)
Parameters
Type Name Description
CellDir fromDir
CellDir toDir
Connection connection
CellRotation cellRotation
Returns
Type Description
System.Boolean
In This Article
Back to top Generated by DocFX