﻿Surface Manifolds
 Surface Manifolds

Surface manifolds are an extension of the topology concept, embedding a topology onto a two-dimensional surface within three-dimensional space.

This topic contains the following sections:

Overview

A manifold is combination of a topology with, at the very minimum, an attribute collection of positions for one of the three topology elements, usually vertex positions. In addition, the topology and positions may be accompanied by an implementation of ISurface, which provides basic descriptions of a surface. Creating a manifold generally consists of first constructing the desired surface, and then using it to further build the topology and vertex positions. Make It Tile includes three concrete surface types, SphericalSurface, RectangularQuadGrid, and RectangularHexGrid.

Spherical Surfaces

Spherical surfaces are of course most naturally used for creating planetary game worlds. They can also be turned inside-out, as if the world was formed on the inside of a hollow planet or the inner surface of a Dyson sphere. After constructing an instance of SphericalSurface, the other manifold elements can be created using functions found in SphericalManifoldUtility. For example, a mostly hexagonal tiling of a sphere can be created by first calling CreateIcosahedron(), followed by Subdivide(), to increase the number of tiles up to roughly the quantity desired, and finally followed by MakeDual to switch from the subdivided triangles from the previous step to hexagons (and twelve pentagons)

Quadrilateral Grids

The other two surfaces are both implementations of the further refinements PlanarSurface and QuadrilateralSurface. The first of course just describing a flat plane, while the latter describes a more-or-less quadralateral shape cut out of such a plane, defined by an point, two axis vectors, and an orientation. These two axes are valuable in that they provide a clear frame of reference for the two-dimensional surface which can be used in a variety of calculations.

The surface type RectangularQuadGrid can be used to describe a grid consisting of identically shaped parallelogram tiles, arranged in specific quantities of rows and columns. The most obvious configuration is a simple grid of squares, but alternatives such as rectangular, diamond, or rectangular tiles are entirely possible too. Because of the regular nature of a quadrilateral grid, two additional interfaces are supported by this class: IVertexIndexer2D and IFaceIndexer2D. These interfaces allow easy lookup of vertices and faces given traditional two-dimensional indexes of the column/row variety, and the inverse operation of finding the column/row position of any given vertex or face.

Hexagonal Grids

The surface type RectangularHexGrid is similar, but uses hexagonal tiles instead of parallelograms. Hexagons are a bit more complex than parallelograms, and hence their description is also a bit more complex. Instead of merely describing two axes that clearly map to the generated parallegrams, the type HexGridDescriptor, used in the construction of a hex grid, requires the specification of three vectors, plus a couple of additional details to fully specify the arrangement of tiles.

Four different ways to configure hexagonal tiles.

Above are some examples of how the shapes of the hexagonal tiles can be specified, by providing vectors for the midpoint, the major corner, and the minor corner. Notice how in the fourth example the minor corner is not between the midpoint vector and the major corner; this affects where the row of hexagons above the first row start. With the first hexagon arrangements above, the first hexagon on the second row will be up and to the right of the first hexagon in the first row. But with the last hexagon arrangement, the first hexagon of the second row will be up and to the left instead. The remaining hexagons on the row will still proceed in the direction of the first (red/x) axis, but this nuance determines the arrangement of corner tiles in your grid in ways that could be significant to game play mechanics.

An additional property of hexagonal tiles to be specified is if the midpoint vector is the first (red/x) or second (green/y) of two axes. In the above diagram, the second hexagon has the midpoint set as the second axis (green/y), in order to get the flat-side-up style of hexagon, while still sticking to the conventional layout of x/y axes.

Straight, staggered, and staggered-symmetric axis styles.

Finally, there are three different axis styles available, demonstrated above. The first style, straight, lines up hexagons along a straight line for both the first and second axis. For regularly shaped hexagons, this forces the overall grid to be skewed, but it keeps the indexing of hexagons simple, as it is easy to identify rows and columns. The second style, staggered, attempts to keep the overall grid rectangular by offsetting every other row. Finally, the style that is both staggered and symmetric also alters the number of tiles in every other row such that there is a mirror symmetry around the axis that is staggered.

See Also