Options
All
  • Public
  • Public/Protected
  • All
Menu
classdesc

The Girih datastructure for generating patterns.

requires

Vertex

requires

GirihTile

requires

GirihBowtie

requires

GirihDecagon

requires

GirihHexagon

requires

GirihPenroseRhombus

requires

GirihPentagon

requires

GirihRhombus

Hierarchy

  • Girih

Index

Constructors

constructor

  • new Girih(edgeLength: number): Girih

Properties

Readonly TILE_TEMPLATES

TILE_TEMPLATES: Array<GirihTile>

An array of all available Girih tiles. Use them as templates for copy-and-paste.

member

{Array}

memberof

Girih

instance

Readonly edgeLength

edgeLength: number

The edge length to use in this Girih pattern.

member

{number}

memberof

Girih

instance

Readonly tiles

tiles: Array<GirihTile>

The actual set of Girih tiles used in this Girih pattern.

member

{Array}

memberof

Girih

instance

Methods

addTile

findPossibleAdjacentTiles

  • findPossibleAdjacentTiles(tileIndex: number, edgeIndex: number): Array<GirihTile>
  • Find all possible adjadent tiles and their locations (type, rotation and offset). The function will return an array of all possible tiles matching at the given tile and edge.

    name

    findPossibleAdjacentTiles

    memberof

    Girih

    instance

    Parameters

    • tileIndex: number

      The index of the tile to rotate.

    • edgeIndex: number

      The index of the tile's edge.

    Returns Array<GirihTile>

    • An array of possible adjecent tiles (already positioned and rotated).

Private initTemplates

  • initTemplates(edgeLength: number): void
  • Initialize the TILE_TEMPLATES array.

    name

    initTemplates

    memberof

    Girih

    instance

    Parameters

    • edgeLength: number

      The edge length to use for the template tiles.

    Returns void

locateConatiningTile

  • locateConatiningTile(position: Vertex): number
  • Find that tile (index) which contains the given position. First match will be returned.

    name

    locateContainingTile

    memberof

    Girih

    instance

    Parameters

    Returns number

    The index of the containing tile or -1 if none was found.

moveTile

  • moveTile(tileIndex: number, moveXAmount: number, moveYAmount: number): void
  • Move that tile the mouse is hovering over. The move amounts are abstract numbers, 1 indicating one unit along each axis.

    name

    moveTile

    memberof

    Girih

    instance

    Parameters

    • tileIndex: number

      The index of the tile to rotate.

    • moveXAmount: number

      The amount to move along the x axis (in pixels).

    • moveYAmount: number

      The amount to move along the y axis (in pixels).

    Returns void

removeTileAt

  • removeTileAt(index: number): void
  • Remove the tile at given array position. The index must be inside valid bounds.

    name

    removeTile

    memberof

    Girih

    instance

    Parameters

    • index: number

      The index in the tiles Array.

    Returns void

replaceTiles

turnTile

  • turnTile(tileIndex: number, turnCount: number): void
  • Turn the tile the mouse is hovering over. The turnCount is ab abstract number: -1 for one turn left, +1 for one turn right. The turning angle is defined by the tile with the lowest turn symmetry: the Decagon, so angle is 36°.

    name

    turnTile

    memberof

    Girih

    instance

    Parameters

    • tileIndex: number

      The index of the tile to rotate.

    • turnCount: number

      A discrete number indicating the number of turn steps.

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Private property
  • Private method
  • Static property
  • Static method

Generated using TypeDoc