msmazes::Parallelepiped<> Class Template Reference
[Core Pattern Layer]

#include <msmazes/core/pattern/parallelepiped.hpp>

List of all members.


Detailed Description

template<>
class msmazes::Parallelepiped<>

This class template is the most commonly understood model of the Physical Pattern concept, because it represents the underlying structure of most traditional mazes.

     typedef msmazes::Parallelepiped<> Tesselation;
     Tesselation parallelepiped;
     parallelepiped.initialize(
         msmazes::OrthogonalTesselationSelector()
       , Tesselation::createCell(0.0, 0.0, 0.0)
       , Tesselation::createCell(3.0, 4.0, 0.0)
       , Tesselation::createCellIncrement(1.0, 2.0, 1.0)
       , Tesselation::createCell(2.0, -1.0, 0.0)
       , Tesselation::createCell(-1.0, 2.0, 0.0)
     );
 

The code above will yield a parallelepiped four cells long, three cells wide, and one cell high. Each cell is 1.0 units away from the nearest neighbor along the x-axis and 2.0 units away from the nearest neighbor along the y-axis. The entrance cell is connected to the cell with coordinates (2.0, 0.0, 0.0), while the exit cell is connected to the cell with coordinates (0.0, 2.0, 0.0). All connections are parallel to either the x-axis or the y-axis.

     typedef msmazes::Parallelepiped<> Tesselation;
     Tesselation parallelepiped;
     parallelepiped.initialize(
         msmazes::UpsilonSquareMinCornerTesselationSelector()
       , Tesselation::createCell(-1.5, -3.0, -1.0)
       , Tesselation::createCell(1.5, 3.0, 1.0)
       , msmazes::setOctagonSquareCellCenterDistance(1.5).setZIncrement(2.0)
       , Tesselation::createCell(0.0, -4.0, -1.0)
       , Tesselation::createCell(0.0, 4.0, 1.0)
     );
 

The code above will yield a parallelepiped three cells long, five cells wide, and two cells high. The parallelepiped has a two-dimensional upsilon tesselation, which means that each cell is either a square or an octagon. A square's neighbors along the x-axis or the y-axis are octagons, and vice-versa.

Each cell is 1.5 units away from the nearest neighbor along the x-axis, 1.5 units away from the nearest neighbor along the y-axis, and 2.0 units away from its neighbor along the z-axis. The entrance cell is connected to the cell with coordinates (0.0, -3.0, -1.0), while the exit cell is connected to the cell with coordinates (0.0, 3.0, 1.0). All connections are parallel to either the x-axis, the y-axis, the z-axis, the y = x, z = 0 line, or the y = -x, z = 0 line. The cells with x-coordinate -1.5 and y-coordinate -3.0 are squares.

     typedef msmazes::Parallelepiped<> Tesselation;
     Tesselation parallelepiped;
     parallelepiped.initialize(
         msmazes::Upsilon26SidedSolidMinCornerTesselationSelector()
       , Tesselation::createCell(-4.0, -3.0, -2.0)
       , Tesselation::createCell(4.0, 3.0, 2.0)
       , 2.0
       , Tesselation::createCell(-2.0, -4.0, -2.0)
       , Tesselation::createCell(2.0, 4.0, 2.0)
     );
 

The code above will yield a parallelepiped five cells long, four cells wide, and three cells high. The parallelepiped has a three-dimensional upsilon tesselation, which means that each cell is either a cube or a 26-sided solid. A cube's neighbors along the x-axis, the y-axis, or the z-axis are 26-sided solids, and vice-versa.

Each cell is 2.0 units away from the nearest neighbor along the x-axis, the y-axis, or the z-axis. The entrance cell is connected to the cell with coordinates (-2.0, -3.0, -2.0), while the exit cell is connected to the cell with coordinates (2.0, 3.0, 2.0). All connections are parallel to either the x-axis, the y-axis, the z-axis, the y = x, z = 0 line, the y = -x, z = 0 line, the z = x, y = 0 line, the z = -x, y = 0 line, the z = y, x = 0 line, or the z = -y, x = 0 line. The cell with coordinates (-4.0, -3.0, -2.0) is a 26-sided-solid.

     typedef msmazes::Parallelepiped<> Tesselation;
     Tesselation parallelepiped;
     parallelepiped.initialize(
         msmazes::ZetaTesselationSelector()
       , Tesselation::createCell(-4.0, -3.0, -1.0)
       , Tesselation::createCell(4.0, 3.0, 1.0)
       , 2.0
       , Tesselation::createCell(-2.0, -4.0, -1.0)
       , Tesselation::createCell(2.0, 4.0, 1.0)
     );
 

The code above will yield a parallelepiped five cells long, four cells wide, and two cells high. Each cell is 2.0 units away from the nearest neighbor along the x-axis, the y-axis, or the z-axis. The entrance cell is connected to the cell with coordinates (-2.0, -3.0, -1.0), while the exit cell is connected to the cell with coordinates (2.0, 3.0, 1.0). All connections are parallel to either the x-axis, the y-axis, the z-axis, the y = x plane, the y = -x plane, the z = x plane, the z = -x plane, the z = y plane, or the z = -y plane; this is the essence of a zeta tesselation.

All programs using this class template must define BOOST_PARAMETER_MAX_ARITY as 9 or more.


Template parameters

Parameter Description Default
DirectionType The type that will represent the course or bearing that is followed when traversing an edge in the underlying graph. unsigned int
DirectionChangeType The type that will represent the change in course or bearing that occurs when traversing two consecutive edges in the underlying graph. int
CellContainerSelector The type that will represent whether the cell container is a std::vector (in which case this type is boost::vecS) or a std::deque (in which case this type is boost::dequeS). boost::vecS
PiConstant The type of the function object returning the constant value PI. sgdk::Pi
TangentFunction The type of the function object returning the tangent of an angle. sgdk::Tangent


Model of


Type requirements



Public Types

typedef implementation_defined Cell
typedef implementation_defined Coordinate
typedef implementation_defined CellEqualityPolicy
typedef implementation_defined Graph
typedef implementation_defined CellIndex
typedef implementation_defined EdgeDirectedCategory
typedef implementation_defined Direction
typedef implementation_defined DirectionChange
typedef implementation_defined OutDegree
typedef implementation_defined HasIndexableEndpointCells

Public Member Functions

 Parallelepiped ()
 The default constructor.
virtual ~Parallelepiped ()
 The destructor.
template<typename TesselationSelector, typename Increment>
void initialize (const TesselationSelector &init_tesselation_selector_arg, const Cell &init_cell_minimum_arg, const Cell &init_cell_maximum_arg, Increment init_cell_increment_arg, const Cell &init_entrance_cell_arg, const Cell &init_exit_cell_arg, const sgdk::ZeroDirection &init_zero_direction_arg, const sgdk::PositiveRotation &init_positive_rotation_arg, const Coordinate init_zero_tolerance_arg)
template<typename Params>
void initialize_with_named_params (Params &p)
const GraphgetGraph () const
CellIndex getCellCount () const
const CellgetCell (const CellIndex index) const
const CellgetEntranceCell () const
const CellgetSourceCell () const
const CellgetTargetCell () const
const CellgetExitCell () const
Direction getEdgeDirection (const CellIndex source_index, const CellIndex target_index) const
DirectionChange getYawTurn (const CellIndex source_index, const CellIndex parent_index, const CellIndex target_index) const
OutDegree getMaxOutDegree () const

Static Public Member Functions

Cell createCell (const Coordinate x, const Coordinate y, const Coordinate z)
Cell createCellIncrement (const Coordinate x, const Coordinate y, const Coordinate z)


Member Typedef Documentation

typedef implementation_defined msmazes::Parallelepiped<>::Cell
 

The type of the objects to be connected together, as defined in the Pattern concept.

typedef implementation_defined msmazes::Parallelepiped<>::Coordinate
 

The type that represents the coordinates of each cell, as defined in the Physical Pattern concept.

typedef implementation_defined msmazes::Parallelepiped<>::CellEqualityPolicy
 

The type of the function object that determines equality between any two cells, as defined in the Pattern concept.

typedef implementation_defined msmazes::Parallelepiped<>::Graph
 

The type of the underlying object that represents the manner in which the cells are connected together, as defined in the Pattern concept.

typedef implementation_defined msmazes::Parallelepiped<>::CellIndex
 

An unsigned integral type for representing either the index of a cell or the number of such cells, as defined in the Pattern concept.

typedef implementation_defined msmazes::Parallelepiped<>::EdgeDirectedCategory
 

The type that represents whether the edges in the underlying graph are undirected, directed, or bidirectional, as defined in the Pattern concept.

typedef implementation_defined msmazes::Parallelepiped<>::Direction
 

The type that represents the course or bearing that is followed when traversing an edge in the underlying graph, as defined in the Pattern concept.

typedef implementation_defined msmazes::Parallelepiped<>::DirectionChange
 

The type that represents the change in course or bearing that occurs when traversing two consecutive edges in the underlying graph, as defined in the Physical Pattern concept.

typedef implementation_defined msmazes::Parallelepiped<>::OutDegree
 

The type that represents the number of edges from a source vertex in the underlying graph, as defined in the Pattern concept.

typedef implementation_defined msmazes::Parallelepiped<>::HasIndexableEndpointCells
 

The type that indicates that the entrance and exit cells are not indexable, as defined in the Pattern concept.


Constructor & Destructor Documentation

msmazes::Parallelepiped<>::Parallelepiped  )  [inline]
 

Constructs a new Parallelepiped. Remember to use initialize() to build the underlying structure!

virtual msmazes::Parallelepiped<>::~Parallelepiped  )  [inline, virtual]
 

Destroys this Parallelepiped.


Member Function Documentation

Cell msmazes::Parallelepiped<>::createCell const Coordinate  x,
const Coordinate  y,
const Coordinate  z
[inline, static]
 

Constructs a new cell for use in initializing this Parallelepiped.

Parameter Name Description Preconditions
x The x-coordinate of the new cell.
y The y-coordinate of the new cell.
z The z-coordinate of the new cell.

Returns:
the new cell.

Cell msmazes::Parallelepiped<>::createCellIncrement const Coordinate  x,
const Coordinate  y,
const Coordinate  z
[inline, static]
 

Constructs the specified increments for a Parallelepiped with an orthogonal tesselation.

Parameter Name Description Preconditions
x_increment The distance between two neighboring cells in the x-axis.
y_increment The distance between two neighboring cells in the y-axis.
z_increment The distance between two neighboring cells in the z-axis.

Returns:
a data structure to be passed to init_cell_increment_arg.

template<typename TesselationSelector, typename Increment>
void msmazes::Parallelepiped<>::initialize const TesselationSelector &  init_tesselation_selector_arg,
const Cell init_cell_minimum_arg,
const Cell init_cell_maximum_arg,
Increment  init_cell_increment_arg,
const Cell init_entrance_cell_arg,
const Cell init_exit_cell_arg,
const sgdk::ZeroDirection &  init_zero_direction_arg,
const sgdk::PositiveRotation &  init_positive_rotation_arg,
const Coordinate  init_zero_tolerance_arg
 

Initializes this Parallelepiped. Violation of the specified preconditions will result in either compile-time errors or failed assertions unless otherwise noted.

Parameter Name Description Preconditions Default
init_tesselation_selector_arg

One of the following:

  • OrthogonalTesselationSelector() will yield a parallelepiped containing horizontal, vertical, and upright connections only.
  • ZetaTesselationSelector will yield a parallelepiped containing horizontal, vertical, upright, and diagonal connections.
  • UpsilonOctagonMinCornerTesselationSelector() will yield a parallelepiped whose cells form an alternating octagon and square pattern. Any two cells whose shapes share a border will also be connected. All cells with x-coordinate init_cell_minimum_arg[0] and y-coordinate init_cell_y_minimum_arg[1] will be octagons. All connections that are parallel to the z-axis will be upright only.
  • UpsilonSquareMinCornerTesselationSelector() will yield a parallelepiped whose cells form an alternating octagon and square pattern. Any two cells whose shapes share a border will also be connected. All cells with x-coordinate init_cell_minimum_arg[0] and y-coordinate init_cell_y_minimum_arg[1] will be squares. All connections that are parallel to the z-axis will be upright only.
  • Upsilon26SidedSolidMinCornerTesselationSelector() will yield a parallelepiped whose cells form an alternating 26-sided-solid and cube pattern. Any two cells whose solids share a face will also be connected. (Physical constraints limit the number of connections from a 26-sided solid to only 18.) The cell init_cell_minimum_arg will be a 26-sided solid.
  • UpsilonCubeMinCornerTesselationSelector() will yield a parallelepiped whose cells form an alternating 26-sided-solid and cube pattern. Any two cells whose solids share a face will also be connected. (Physical constraints limit the number of connections from a 26-sided solid to only 18.) The cell init_cell_minimum_arg will be a cube.
init_cell_minimum_arg The cell at the intersection of the coordinates' lower bounds.
init_cell_maximum_arg The cell at the intersection of the coordinates' upper bounds.
  • init_cell_minimum_arg[0] < init_cell_maximum_arg[0]
  • init_cell_minimum_arg[1] < init_cell_maximum_arg[1]
  • init_cell_minimum_arg[2] <= init_cell_maximum_arg[2]
init_cell_increment_arg
  • If TesselationSelector is the same as ZetaTesselationSelector, defines the distance from the center of a cell to the center of a neighboring cell along a primary axis.
  • If TesselationSelector is the same as Upsilon26SidedSolidMinCornerTesselationSelector or UpsilonCubeMinCornerTesselationSelector, defines the distance from the center of a cube cell to the center of a neighboring 26-sided-solid cell.
  • If TesselationSelector is the same as UpsilonOctagonMinCornerTesselationSelector or UpsilonSquareMinCornerTesselationSelector, is a dot-operator-combined pair of function calls; one of them defines the distance from the center of a square cell to the center of a neighboring octagon cell, while the other defines the distance between two cells that neighbor each other along the z-axis.
  • If TesselationSelector is the same as OrthogonalTesselationSelector, is a cell whose x-coordinate defines the distance between two cells that neighbor each other along the x-axis, whose y-coordinate defines the distance between two cells that neighbor each other along the y-axis, and whose z-coordinate defines the distance between two cells that neighbor each other along the z-axis.
  • If TesselationSelector is the same as OrthogonalTesselationSelector, then Parallelepiped::createCellIncrement() must be used.
  • If TesselationSelector is the same as UpsilonOctagonMinCornerTesselationSelector or UpsilonSquareMinCornerTesselationSelector, then either msmazes::setOctagonSquareCellCenterDistance().setZIncrement() or msmazes::setZIncrement().setOctagonSquareCellCenterDistance() must be used.
  • If TesselationSelector is the same as Upsilon26SidedSolidMinCornerTesselationSelector, UpsilonCubeMinCornerTesselationSelector, or ZetaTesselationSelector, then Increment must be convertible to Coordinate.
  • All the relevant components of init_cell_increment_arg must be greater than zero.
init_entrance_cell_arg The entrance cell.
init_exit_cell_arg The exit cell.
init_zero_direction_arg The input that a finite state machine that processes directional inputs will recognize as zero. sgdk::ZeroDirection::POSITIVE_Y_AXIS
init_positive_rotation_arg The rotational direction that a finite state machine that processes yaw inputs will recognize as upward from the finite state machine's current orientation. sgdk::PositiveRotation::CLOCKWISE
init_zero_tolerance_arg See the sgdk::ZeroChecker reference documentation. The default value is sufficient in most cases. 0.000001

You can also pass the arguments by name. Use the parameter table above to look up the parameter names. Remember that each parameter name resides in the msmazes namespace.

template<typename Params>
void msmazes::Parallelepiped<>::initialize_with_named_params Params &  p  )  [inline]
 

Initializes this Parallelepiped via the specified Argument Pack object. See the initialize() function documentation for acceptable parameters.

const Graph& msmazes::Parallelepiped<>::getGraph  )  const [inline]
 

Returns a const reference to the underlying object that represents the manner in which the cells are connected together in this Parallelepiped, as defined in the Pattern concept.

CellIndex msmazes::Parallelepiped<>::getCellCount  )  const [inline]
 

Returns the number of cells in this Parallelepiped, as defined in the Pattern concept.

const Cell& msmazes::Parallelepiped<>::getCell const CellIndex  index  )  const [inline]
 

Returns a const reference to the cell in this Parallelepiped to which the specified index refers, as defined in the Pattern concept.

const Cell& msmazes::Parallelepiped<>::getEntranceCell  )  const [inline]
 

Returns a const reference to the entrance cell in the solution path of an overlying maze, as defined in the Pattern concept.

const Cell& msmazes::Parallelepiped<>::getSourceCell  )  const [inline]
 

Returns a const reference to the cell that topologically follows the entrance cell in the solution path of an overlying maze, as defined in the Pattern concept.

const Cell& msmazes::Parallelepiped<>::getTargetCell  )  const [inline]
 

Returns a const reference to the cell that topologically precedes the exit cell in the solution path of an overlying maze, as defined in the Pattern concept.

const Cell& msmazes::Parallelepiped<>::getExitCell  )  const [inline]
 

Returns a const reference to the exit cell in the solution path of an overlying maze, as defined in the Pattern concept.

Direction msmazes::Parallelepiped<>::getEdgeDirection const CellIndex  source_index,
const CellIndex  target_index
const [inline]
 

Returns a representation of the course or bearing that is followed when traversing the corresponding edge in the underlying graph, as defined in the Pattern concept.

DirectionChange msmazes::Parallelepiped<>::getYawTurn const CellIndex  source_index,
const CellIndex  parent_index,
const CellIndex  target_index
const [inline]
 

Returns the change in course or bearing that occurs when traversing the corresponding edges in the underlying graph, as defined in the Physical Pattern concept.

OutDegree msmazes::Parallelepiped<>::getMaxOutDegree  )  const [inline]
 

Returns the maximum number of edges from any source vertex in the underlying graph, as defined in the Pattern concept.


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