msmazes::SpherePattern<> Class Template Reference
[Core Pattern Layer]
#include <msmazes/core/pattern/sphere.hpp>
List of all members.
Detailed Description
template<>
class msmazes::SpherePattern<>
This class template is a simple model of the Physical Pattern concept, but its inherent three-dimensional nature should make any maze built on top of one a challenge to solve.
typedef msmazes::SpherePattern<> Sphere;
Sphere sphere;
sphere.initialize(
msmazes::OctahedronSelector()
, Sphere::createCell(0.0, 0.0, 0.0)
, 1.0
, 5.0
, 2.0
, Sphere::createCell(7.0, 0.0, 0.0)
, Sphere::createCell(0.0, 7.0, 0.0)
);
The code above will produce three concentric spherical layers around the origin, one of radius 1.0, the next of radius 3.0, and the last of radius 5.0. Each layer's cells and connections form the vertices and edges, respectively, of an octahedron, so each layer has six cells, and each cell has four face-edge connections. The entrance and exit cells have coordinates (7.0, 0.0, 0.0) and (0.0, 7.0, 0.0), respectively.
typedef msmazes::SpherePattern<> Sphere;
Sphere sphere;
sphere.initialize(
msmazes::IcosahedronSelector()
, Sphere::createCell(0.0, 0.0, 0.0)
, 1.0
, 5.0
, 2.0
, Sphere::createCell(7.0, 0.0, 0.0)
, Sphere::createCell(0.0, 7.0, 0.0)
);
The settings are almost the same, but these layers' cells and connections form the vertices and edges, respectively, of icosahedrons, so each layer has twenty cells, and each cell has five face-edge connections.
typedef msmazes::SpherePattern<> Sphere;
Sphere sphere;
sphere.initialize(
msmazes::BuckyballSelector()
, Sphere::createCell(0.0, 0.0, 0.0)
, 1.0
, 5.0
, 2.0
, Sphere::createCell(7.0, 0.0, 0.0)
, Sphere::createCell(0.0, 7.0, 0.0)
);
This time, the layers' cells and connections form the vertices and edges, respectively, of truncated icosahedrons, or buckyballs, so each layer has sixty cells, and each cell has three face-edge connections.
Of course, each layer is connected to an adjacent layer by means of radial-edge connections, which point away from or toward the centroid.
All programs using this class template must define BOOST_PARAMETER_MAX_ARITY as 9 or more.
Template parameters
Parameter | Description | Default |
CoordinateType | The value type of the coordinates in each cell. | double |
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 |
Model of
Type requirements
-
CoordinateType
must be a floating-point type.
-
DirectionChangeType
must be a signed integer type.
-
CellContainerSelector
must be either boost::vecS
or boost::dequeS
.
|
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 |
| SpherePattern () |
| The default constructor.
|
virtual | ~SpherePattern () |
| The destructor.
|
template<typename TesselationSelector> |
void | initialize (const TesselationSelector &init_tesselation_selector_arg, const Cell &init_centroid_arg, const Coordinate init_radial_increment_arg, const Coordinate init_radius_maximum_arg, const Coordinate init_radius_minimum_arg, const Cell &init_entrance_cell_arg, const Cell &init_exit_cell_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 Graph & | getGraph () const |
CellIndex | getCellCount () const |
const Cell & | getCell (const CellIndex index) const |
const Cell & | getEntranceCell () const |
const Cell & | getSourceCell () const |
const Cell & | getTargetCell () const |
const Cell & | getExitCell () 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) |
Member Typedef Documentation
|
The type of the objects to be connected together, as defined in the Pattern concept. |
|
The type that represents the coordinates of each cell, as defined in the Physical Pattern concept. |
|
The type of the function object that determines equality between any two cells, as defined in the Pattern concept. |
|
The type of the underlying object that represents the manner in which the cells are connected together, as defined in the Pattern concept. |
|
An unsigned integral type for representing either the index of a cell or the number of such cells, as defined in the Pattern concept. |
|
The type that represents whether the edges in the underlying graph are undirected, directed, or bidirectional, as defined in the Pattern concept. |
|
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. |
|
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. |
|
The type that represents the number of edges from a source vertex in the underlying graph, as defined in the Pattern concept. |
|
The type that indicates that the entrance and exit cells are not indexable, as defined in the Pattern concept. |
Constructor & Destructor Documentation
|
Constructs a new SpherePattern . |
|
Destroys this SpherePattern . |
Member Function Documentation
|
Constructs a new cell for use in initializing this SpherePattern .
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.
|
template<typename TesselationSelector> |
void msmazes::SpherePattern<>::initialize |
( |
const TesselationSelector & |
init_tesselation_selector_arg, |
|
|
const Cell & |
init_centroid_arg, |
|
|
const Coordinate |
init_radial_increment_arg, |
|
|
const Coordinate |
init_radius_maximum_arg, |
|
|
const Coordinate |
init_radius_minimum_arg, |
|
|
const Cell & |
init_entrance_cell_arg, |
|
|
const Cell & |
init_exit_cell_arg, |
|
|
const sgdk::PositiveRotation & |
init_positive_rotation_arg, |
|
|
const Coordinate |
init_zero_tolerance_arg |
|
) |
|
|
|
Initializes this SpherePattern . 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:
-
OctahedronTesselationSelector() will yield a set of spheres whose cells and connections form the vertices and edges, respectively, of octahedrons.
-
IcosahedronTesselationSelector() will yield a set of spheres whose cells and connections form the vertices and edges, respectively, of icosahedrons.
-
BuckyballTesselationSelector() will yield a set of spheres whose cells and connections form the vertices and edges, respectively, of buckyballs.
Two cells may also be connected if the direction from one to the other is radial, i.e. pointing toward or away from the centroid. | | |
init_centroid_arg | A cell representing the centroid of the sphere layers. | | |
init_radius_minimum_arg | The distance from the centroid to the innermost layer of cells. |
-
( 0.0 < init_radius_minimum_arg )
| |
init_radius_maximum_arg | The distance from the centroid to the outermost layer of cells. |
-
( init_radius_minimum_arg <= init_radius_maximum_arg )
| |
init_radial_increment_arg | The distance between any two adjacent layers of cells. |
-
( 0.0 < init_radial_increment_arg )
| |
init_entrance_cell_arg | The entrance cell. | | |
init_exit_cell_arg | The exit cell. | | |
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. |
|
Initializes this SpherePattern via the specified Argument Pack object. See the initialize() function documentation for acceptable parameters. |
|
Returns a const reference to the underlying object that represents the manner in which the cells are connected together in this SpherePattern , as defined in the Pattern concept. |
|
Returns the number of cells in this SpherePattern , as defined in the Pattern concept. |
|
Returns a const reference to the cell in this SpherePattern to which the specified index refers, as defined in the Pattern concept. |
|
Returns a const reference to the entrance cell in the solution path of an overlying maze, as defined in the Pattern concept. |
|
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. |
|
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. |
|
Returns a const reference to the exit cell in the solution path of an overlying maze, as defined in the Pattern concept. |
|
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. |
|
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. |
|
Returns the maximum number of edges from any source vertex in the underlying graph, as defined in the Pattern concept. |