Show / Hide Table of Contents

Class NGonCellType

Cell type for a regular polygon with n sides. The CellDirs are simply the numbers 0 to n-1 with dir 0 being to the right. The CellRotations are the numbers 0 to n-1 for a CCW rotation of that many sides, plus numbers ~0 to ~(n-1) for the reflections, where rotation ~0 has dir 0 as a fix point.

The canonical shape (for use with deformations) is a regular polygon with incircle diamater 1.0 in the XY centered at the origin, with normal pointing Z-forward.

Inheritance
object
NGonCellType
Implements
ICellType
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: Sylves
Assembly: Sylves.dll
Syntax
public class NGonCellType : ICellType

Properties

N

Declaration
public int N { get; }
Property Value
Type Description
int

ReflectX

Declaration
public CellRotation ReflectX { get; }
Property Value
Type Description
CellRotation

ReflectY

Declaration
public CellRotation ReflectY { get; }
Property Value
Type Description
CellRotation

RotateCCW

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

RotateCW

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

Methods

Extract(ICellType)

Returns N for cellType is an NGonCellType. Also returns similar values for SquareCellType and HexCellType, as they are compatible with NGonCellType. Other celltypes return null.

Declaration
public static int? Extract(ICellType cellType)
Parameters
Type Name Description
ICellType cellType
Returns
Type Description
int?

Format(CellCorner)

Declaration
public string Format(CellCorner corner)
Parameters
Type Name Description
CellCorner corner
Returns
Type Description
string

Format(CellCorner, int)

Declaration
public static string Format(CellCorner corner, int n)
Parameters
Type Name Description
CellCorner corner
int n
Returns
Type Description
string

Format(CellDir)

Declaration
public string Format(CellDir dir)
Parameters
Type Name Description
CellDir dir
Returns
Type Description
string

Format(CellDir, int)

Declaration
public static string Format(CellDir dir, int n)
Parameters
Type Name Description
CellDir dir
int n
Returns
Type Description
string

Format(CellRotation)

Declaration
public string Format(CellRotation rotation)
Parameters
Type Name Description
CellRotation rotation
Returns
Type Description
string

Format(CellRotation, int)

Declaration
public static string Format(CellRotation rotation, int n)
Parameters
Type Name Description
CellRotation rotation
int n
Returns
Type Description
string

FromMatrix(Matrix4x4)

Declaration
public CellRotation? FromMatrix(Matrix4x4 matrix)
Parameters
Type Name Description
Matrix4x4 matrix
Returns
Type Description
CellRotation?

Get(int)

Returns the cell type corresponding to a polygon with n sides.

Declaration
public static ICellType Get(int n)
Parameters
Type Name Description
int n
Returns
Type Description
ICellType

GetCellCorners()

Gets all the CellCorner used by this cell type.

Declaration
public IEnumerable<CellCorner> GetCellCorners()
Returns
Type Description
IEnumerable<CellCorner>

GetCellDirs()

Gets all the CellDir used by this cell type.

Declaration
public IEnumerable<CellDir> GetCellDirs()
Returns
Type Description
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
public Vector3 GetCornerPosition(CellCorner corner)
Parameters
Type Name Description
CellCorner corner
Returns
Type Description
Vector3

GetIdentity()

Returns the rotation that leaves everything unchanged

Declaration
public 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
public Matrix4x4 GetMatrix(CellRotation cellRotation)
Parameters
Type Name Description
CellRotation cellRotation
Returns
Type Description
Matrix4x4

GetRotations(bool)

Gets all possible rotations of this cell type.

Declaration
public IList<CellRotation> GetRotations(bool includeReflections = false)
Parameters
Type Name Description
bool includeReflections
Returns
Type Description
IList<CellRotation>

Invert(CellDir)

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

Declaration
public CellDir? Invert(CellDir dir)
Parameters
Type Name Description
CellDir dir
Returns
Type Description
CellDir?

Invert(CellRotation)

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

Declaration
public 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
public CellRotation Multiply(CellRotation a, CellRotation b)
Parameters
Type Name Description
CellRotation a
CellRotation b
Returns
Type Description
CellRotation

Rotate(CellCorner, CellRotation)

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

Rotate(CellDir, CellRotation)

Rotates a dir by the given rotation.

Declaration
public 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
public 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
public bool TryGetRotation(CellDir fromDir, CellDir toDir, Connection connection, out CellRotation rotation)
Parameters
Type Name Description
CellDir fromDir
CellDir toDir
Connection connection
CellRotation rotation
Returns
Type Description
bool

Implements

ICellType
In this article
Back to top Generated by DocFX