Physical Pattern Concept

A Physical Pattern, also known as a tesselation, is a Pattern whose cells hold the coordinates of physical locations. Any Pattern Former used to initialize it is usually a model of the Tesselation Former concept.


Notation


Refinement of

Pattern


Associated Types

In addition to the types defined in the Pattern concept, the following types are introduced.
Name Expression Description
Coordinate type P::Coordinate A type for representing the coordinates of each cell.
Direction change type P::DirectionChange A type for representing the change in course or bearing that occurs when traversing two consecutive edges in the underlying graph.

In addition, the requirements for the cell and indexability types are strengthened: the cell type must model the Physical Cell concept, and the indexability type must be equivalent to boost::mpl::false_.


Valid Expressions

In addition to the expressions defined in the Pattern concept, the following expressions must be valid.
Name Expression Type Requirements Return Type
Yaw turn p.getYawTurn(source_index, parent_index, target_index) All three arguments must be convertible to P::CellIndex. P::DirectionChange


Expression Semantics

After initialization, the following semantics must apply.
Name Expression Precondition Semantics Postcondition
Yaw turn pattern.getYawTurn(source_index, parent_index, target_index)
  • 0 < parent_index && parent_index <= pattern.getCellCount()
  • If source_index == parent_index, then the underlying graph must contain an edge between the vertices that correspond to pattern.getEntranceCell() and pattern.getCell(parent_index). Otherwise, 0 < source_index && source_index <= pattern.getCellCount(), and the underlying graph must contain an edge between the vertices that correspond to pattern.getCell(source_index) and pattern.getCell(parent_index).
  • If target_index == pattern.getCellCount(), then the underlying graph must contain an edge between the vertices that correspond to pattern.getCell(parent_index) and pattern.getExitCell(). Otherwise, 0 < target_index && target_index <= pattern.getCellCount(), and the underlying graph must contain an edge between the vertices that correspond to pattern.getCell(parent_index) and pattern.getCell(target_index).
Returns the change in course or bearing that occurs when traversing the corresponding edges in the underlying graph.


Invariants and Runtime Complexity Guarantees

In addition to the invariants and guarantees defined in the Pattern concept, the following invariants must hold.
Name Invariants Runtime complexity
Entrance and source cell connection The entrance cell will be connected to the closest indexable cell in the tesselation; this cell will be the source cell.
Exit and target cell connection The exit cell will be connected to the closest indexable cell in the tesselation; this cell will be the target cell.
Yaw turn Valid after initialization. Amortized constant time


Models



Multi-State Mazes in C++ is hosted by SourceForge.net. Use the Table of Contents for navigation.