I have a problem where I want to easily map a set to the faces of a n-dimensional hypercube.
For sake of example.
For a 1d hypercube we have a line segment $[A,B]$ where the faces are the points $A$ and $B$. That we loosely call: left and right.
For a 2d hypercube we have a square with the points $[A,B,C,D]$ where $\overline{AB}$, $\overline{AC}$, $\overline{CD}$, $\overline{BD}$. That we call left, right, up, down.
For a 3d hypercube we have the cube with points $[A,B,C,D,E,F,G,H]$ where the faces are $\overline{ABCD}$, $\overline{EFGH}$, $\overline{ABEF}$, $\overline{CDGH}$, $\overline{BCFG}$, $\overline{ADEH}$, that we call: up, down, left, right, front and back.
And goes on, the 4D isn't so simple to describe, since lacks me the construtive view.
My questions are:
How to generalize the construction of the faces for any n-dimensional hypercube.
How to create a map? I initially thought in a vector map for example:
1d case: $[A,B] \to [1,0]$ or $[0,1]$ (for left and right).
2d case: $[A,B,C,D] \to \left\{ [1,1,0,0], [1,0,1,0],[0,0,1,1], [0,1,0,1] \right\}$
3d case: $[A,B,C,D,E,F,G] \to \left\{ [1,1,1,1,0,0,0,0], [0,0,0,0,1,1,1,1], [1,1,0,0,1,1,0,0], [0,0,1,1,0,0,1,1], [0,1,1,0,0,1,1,0], [1,0,0,1,1,0,0,1] \right\}$
Of course it depends in orientation of the face creation and point distribution. We have to avoid the diagonal for example in $2d$ case $[0,1,1,0], [1,0,0,1]$ should not be valid since is the diagonal line (if we take the same square defined above). My 2d square is like:
A o-------o B
| |
| |
C o-------o D
My second issue is that the map leads to a very sparse structures for example the 3D cases we have only 6 valid combinations (not taking in account the simetrics) where the set has $2^8=64$ patterns.
Of course I can map the sets $U \to V \to W $ as:
$ U \equiv \mathbb{N} $
$ V \equiv $ valid face bits
$ W \equiv $ cube faces
In 3D case:
$ U = \left\{ 0,1,2,3,4,5 \right\} $
$ V = \left\{ [1,1,1,1,0,0,0,0] , [0,0,0,0,1,1,1,1], [1,1,0,0,1,1,0,0]\\, [0,0,1,1,0,0,1,1], [0,1,1,0,0,1,1,0], [1,0,0,1,1,0,0,1] \right\}$
$ W = \overline{ABCD}, \overline{EFGH}, \overline{ABEF}, \overline{CDGH}, \overline{BCFG}, \overline{ADEH}$
The reason that I'm doing this is because I want to apply filters on borders of a N-dimensional mesh and I want to be able to know which faces I want to apply.
Any ideas are welcome?
Assume for simplicity that all $2^d$ vertices of the $d$-dimensional dimensional cube are binary $d$-tuples. Then any face of the cube can be encoded by a pair of numbers $(n,r)$ where $n$ is the position in the $d$-tuple and $r$ is either 0 or 1. Accordingly there are altogether $2d$ faces, each face being a $(d-1)$-dimensional cube.
For example a face of 8-dimensional cube encoded $(5,0)$ has the vertices: $$ (r_1,r_2,r_3,r_4,0,r_6,r_7,r_8), $$ where $r_i$ run over $(0,1)$. The opposite face encoded $(5,1)$ has corresponding vertices at: $$(r_1,r_2,r_3,r_4,1,r_6,r_7,r_8). $$