I am creating a customizable D20 for 3D printing using OpenSCAD, with the following code:
factor=5;
$fn=10;
PHI=(1+sqrt(5))/2;
//Taken from: http://en.wikipedia.org/wiki/Icosahedron#Cartesian_coordinates
//Specifically: http://en.wikipedia.org/w/index.php?title=Icosahedron&oldid=568753314#Cartesian_coordinates
POINTS = [ [0,-1,-PHI] , [0,-1,+PHI] , [0,+1,-PHI] , [0,+1,+PHI] ,
[-1,-PHI,0] , [-1,+PHI,0] , [+1,-PHI,0] , [+1,+PHI,0] ,
[-PHI,0,-1] , [+PHI,0,-1] , [-PHI,0,+1] , [+PHI,0,+1]
]*factor;
FACES =[ [1,3,11],[1,11,6], [1,6,4], [1,4,10],[1,10,3],
[3,5,7], [3,7,11], [3,5,10],[11,6,9],[11,7,9],
[0,6,9], [0,6,4], [0,8,4], [10,8,4],[10,8,5],
[2,8,5], [0,2,9], [0,2,8], [7,2,9], [5,2,7]];
function normal(n) =
//Calculates the position of the center of the nth face (also called the normal vector of the face)
POINTS[FACES[n][0]]/3 +
POINTS[FACES[n][1]]/3 +
POINTS[FACES[n][2]]/3 ;
//spheres at each vertex
hull(){
for(i=[1:12]){
translate(POINTS[i-1]) sphere(.0001);
}
}
An icosahedron has 12 vertices given by POINTS, and the faces (triangles) are formed by the triplets in FACES where each number i is the i-th element in the list POINTS. OpenSCAD uses the C convention where the first element is 0, not 1.
Typical dice are numbered so that for an N-sided die, the number on a given side, and the number on an opposite side add up to N+1. How can I tell Mathematica to find the order of faces so that "ONE" should be placed at the face given by FACES[[1]], and all the other numbers should have the N+1 property above.
For a given solid that would work as a die, is there another condition I have to apply? e.g. is it necessary or optimal to enforce or check that the sum of numbers around a given vertex (or edge?) is not more than a certain amount than the sum from another vertex or edge? From this picture (https://en.wikipedia.org/wiki/Dice#mediaviewer/File:6sided_dice.jpg) it seems that on a normal D6 that there is a vertex that is adjacent to 4,5,6 and therefore the opposite vertex is adjacent to 1,2,3.
Here are the data in Mathematica format:
PHI=(1+Sqrt[5])/2;
POINTS = { {0,-1,-PHI} , {0,-1,+PHI} , {0,+1,-PHI} , {0,+1,+PHI} ,{-1,-PHI,0} , {-1,+PHI,0} , {+1,-PHI,0} , {+1,+PHI,0} , {-PHI,0,-1} , {+PHI,0,-1} , {-PHI,0,+1} , {+PHI,0,+1} };
FACES ={ {1,3,11},{1,11,6}, {1,6,4}, {1,4,10},{1,10,3}, {3,5,7}, {3,7,11}, {3,5,10},{11,6,9},{11,7,9}, {0,6,9}, {0,6,4}, {0,8,4}, {10,8,4},{10,8,5}, {2,8,5}, {0,2,9}, {0,2,8}, {7,2,9}, {5,2,7}};


Gatherwith "is parallel to" as criterion. That way you'd get a list of pairs, containing sites opposite to each other. Then you could useTransposeon that list, and thenReverseon the second element of the result. Then applyJointo get back to a single list. Then the positions in the list are such that the opposite sides have indices which add to the same number (namely $d+1$ for a D$d$), so you can just give each side its index in that list as number. – celtschk Jul 18 '14 at 13:11