It may be worth noting that in arriving at my definition of surfaces I looked at the cube as a lattice of points with 1 1 1 at the top and _1 _1 _1 at the bottom. I then thought of the three edges that are unique to each of those points. The surfaces fall out from those by choosing one direction of adjacency. I generate three sides, then produce the others by mirroring.
The integers in each item are the indices of the intersected points for that surface. -- T On Thu, Apr 1, 2010 at 2:10 PM, Raul Miller <[email protected]> wrote: > I am looking for elegant ways of describing cubes in J. > > For example: > > points=: _1+2*#:i.8 > surfaces=: 1 A. I. (, 1 - |.) 8&$...@#&0 1">4 2 1 > > Here, points is a list of vertices and a vertex is > a list of xyz coordinates, and surfaces is a list > of polygons where a polygon is a list of > four vertex indices. > > Here, I consider 'points' to be elegant, but I am > looking for something more meaningful (and yet > still concise) for surfaces. > > Here is an example of an equivalent but more meaningful > expression for surfaces: > > surfaces=: 1 A."1 I. (#~ (1 e. [: */^:2 0: = points -"1/~...@#~ ])"1) > (#~ 4=+/"1)#:i.2^#points > > Here, I start by generating every combination of the available > points, choosing those combinations which have four > points, then choosing those combinations which are coplanar > and then rearranging them. This is somewhat meaningful > (though that 1 A. bothers me), but it is not concise. > > Does anyone have any good ideas for a meaningful > sentence to define 'surfaces'? > > Thanks, > > -- > Raul > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
