Perhaps something like this? ( , 7-]) |: 0, 1 2 4 +"_1 _ i.3 0 1 2 4 0 2 3 5 0 3 4 6 7 6 5 3 7 5 4 2 7 4 3 1
-- 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
