# n-cubes notes and information about n-cubes that i could not find summarized in other places. an n-cube, also known as a hypercube, is a geometric figure in n-dimensional space, characterized by being composed of points whose coordinates are constrained within a unit interval [0,1]. each edge of the n-cube is orthogonal (perpendicular) to every other edge, extending in mutually orthogonal directions. # n-cube vertex finding and drawing conventions for this section: * "n" are the number of dimensions. * vertices represented as unit bitvectors represented as integers interpreted as binary # cell vertices n-cell: "2 ** n" in this example, we filter the vertices of each sub-cell. it would be possible to generate the vertices separately. * for "k" from 1 to "n - 1" * for each possible k-combination of component indices * for each n-bit sequence of the selected indices * combine with each n-bit sequence of the remaining indices ## example the following templates are the basis for the 2-cube faces of a 4-cube. components at "f" are fixed for each face and all variations of "v" (either 0 or 1) create its vertices. ~~~ ffvv fvfv fvvf vffv vfvf vvff ~~~ the four vertices of one square side of a 4-cube with the pattern vfvf and fixed values v0v1: ~~~ 0001 0011 1001 1011 ~~~ 3-cube * 1 vary, 2 fix - edges * 2 vary, 1 fix - squares 4-cube * 1 vary, 3 fix - edges * 2 vary, 2 fix - squares * 3 vary, 1 fix - cubes # algorithms * gospers hack for combinations # notes * since squares are the lowest dimensional shape that encapsulates the logic shared by all n-cubes, maybe n-cubes should ideally be referred to as n-squares * since the edges of the faces of a cube overlap, it is not possible to draw a cube square by square without visiting some edges multiple times * volume: "side_length ** dimensions" * the facets (also called hyperfaces) of a n-polytope are the (n - 1)-faces (faces of dimension one less than the polytope itself) # counts cell counts * 4-cube * 0-cells: 16 vertices * 1-cells: 32 edges * 2-cells: 24 square faces * 3-cells: 8 cube volumes * 4-cell: 1 * 3-cube * 0-cells: 8 vertices * 1-cells: 12 edges * 2-cells: 6 square faces * 3-cell: 1 * 2-cube * 0-cells: 4 vertices * 1-cells: 4 edges * 2-cell: 1 adjacent cell counts * 3-cube * each vertex has 3 edges * each edge has 2 faces * 4-cube * each vertex has 4 edges * each edge has 3 faces # analogies * square to cube: extrude (sweep) the square along an axis perpendicular to its plane * circle to cylinder: extrude the circle along an axis perpendicular to its plane * circle to sphere: rotate the circle around one of its diameters * square to solid of revolution: rotate the square around an axis (this forms a shape like a cylinder)