John's solution below may be modified. 

Let the eight corners be >:#:i.8
1 1 1
1 1 2
1 2 1
1 2 2
2 1 1
2 1 2
2 2 1
2 2 2

Use the zero as a wildcard character. So the twelve edges are
0 1 1
0 1 2
0 2 1
0 2 2
1 0 1
1 0 2
1 1 0
1 2 0
2 0 1
2 0 2
2 1 0
2 2 0

and the six faces are
0 0 1
0 0 2
0 1 0
0 2 0
1 0 0
2 0 0

and the cube itself is
0 0 0

The twentyseven elements of the cube are coded by
   3 3 3 #: i.27
0 0 0
0 0 1
0 0 2
0 1 0
0 1 1
0 1 2
0 2 0
0 2 1
0 2 2
1 0 0
1 0 1
1 0 2
1 1 0
1 1 1
1 1 2
1 2 0
1 2 1
1 2 2
2 0 0
2 0 1
2 0 2
2 1 0
2 1 1
2 1 2
2 2 0
2 2 1
2 2 2


--- Den fre 2/4/10 skrev John Randall <[email protected]>:

Fra: John Randall <[email protected]>
Emne: Re: [Jprogramming] cubes
Til: "Programming forum" <[email protected]>
Dato: fredag 2. april 2010 16.59

Raul Miller wrote:
> I am looking for elegant ways of describing cubes in J.

Here is an alternative system for cube coordinates.

Label the points

   #: i. 8
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

Now a face is given by a set of points with 1 coordinate fixed, e.g.

0 0 0
0 0 1
1 0 0
1 0 1

and an edge is given by a set of points with 2 coordinates fixed, e.g.

1 0 0
1 0 1

This generalizes to higher dimensional cubes.

Best wishes,

John



----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


__________________________________________________
Bruger du Yahoo!?
Er du træt af spam?  Yahoo!Mail har den bedste spambeskyttelse, der findes 
http://dk.mail.yahoo.com 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to