Some minor points remain:
- If a diagonal vector has some coordinates equal to 0, the cube is of lower
dimension then the space it is in and we could call it degenerate.
- the (origin ,: diagonal) representation of a cube is not unique. Actually
there are 2^d such representations, one for each vertex.
Given C=: 10 20 30 40 ,: 1 2 3 4 , the other representations are obtained
by
(#:i.2 ^ {:$ C) 4 : 'x}y'"1 2"1 _ (({. ,: +/) ,: {:,: -...@{:)C
10 20 30 40
1 2 3 4
10 20 30 44
1 2 3 _4
10 20 33 40
1 2 _3 4
10 20 33 44
1 2 _3 _4
10 22 30 40
1 _2 3 4
10 22 30 44
1 _2 3 _4
10 22 33 40
1 _2 _3 4
10 22 33 44
1 _2 _3 _4
11 20 30 40
_1 2 3 4
11 20 30 44
_1 2 3 _4
11 20 33 40
_1 2 _3 4
11 20 33 44
_1 2 _3 _4
11 22 30 40
_1 _2 3 4
11 22 30 44
_1 _2 3 _4
11 22 33 40
_1 _2 _3 4
11 22 33 44
_1 _2 _3 _4
- it is sometimes worthwhile to get an enumeration of the vertices of a
(face of a) cube with two succeeding vertices sharing one edge. As is
pointed out before, a Gray code can be used for that:
((3 : '((0 ,. ]) , 1 ,. |.)^:y i.1 0') {:$ C) 4 : 'x}y'"1 _ ({. ,: +/)
C
10 20 30 40
10 20 30 44
10 20 33 44
10 20 33 40
10 22 33 40
10 22 33 44
10 22 30 44
10 22 30 40
11 22 30 40
11 22 30 44
11 22 33 44
11 22 33 40
11 20 33 40
11 20 33 44
11 20 30 44
11 20 30 40
R.E. Boss
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm