Okay, it sounds *really* obvious, but I'm looking for a clever way to make it small.
Nothing special on the cube - 8 vertices, 6 sides, 12 edges:

Generating the vertices is trivial.
Looping through all vertex-indices
i [0..7], we get the x,y,z-coordinates in [0..1] with:
x= (i+1)>>1&1;
y= i >> 1 & 1;
z= i >> 2 & 1;(Swapping 2/3 and 6/7 simplifies x to
"i & 1", but keeping them clockwise gives ready-to-use quad-order).
Now to the interessting part - extracting the 12 edges.
Each edge is defined by two vertex-indices:
0-1, 1-2, 2-3, 3-0, 4-5, 5-6, 6-7, 7-4, 0-4, 1-5, 2-6, 3-7
Since each index [0..7] requires only 3 bits, we could simply store these, eg each pair in 1 byte (using 4bits each for readability) - resulting in 12 bytes of storage.
Looping through all edges
e we can look up the edge-indices from the table:
char edges[12]= {0x01,0x12,0x23,0x30,0x45,0x56,0x67,0x74, 0x04,0x15,0x26,0x37};
v1= edges[e] >> 4 & 0xf;
v2= edges[e] & 0xf;But looking at the upper nibble of each byte (012345670123) we certainly won't store that, but get v1 from e:
v1= e & 7;All that's left are 12 3bit values (=36bit; how unhandy).
So all we need is a function to get v2 from e:
input: 0123 4567 89AB
output: 1230 5674 4567Obviously the function should be smaller than space (+extraction) needed to store the table...
Ideas anyone?
