Here's how far I got translating it to Raul's method.  I can't generalize to
nxn squares.

load 'viewmat'
 
'E B G C R M Y W'=:#:i.8
V=:<E;E;E
FRONT=:<M;R;W
LEFT=:<M;W;B   
TOP=:<W;Y;C
BACK=:<C;G;B  
RIGHT=:<G;Y;E
BASE=:<B;E;M
   
face=: 3 :0
'O X Y'=.y
brush=.D=: <.255*O+"1]0.5*((i.3)*/Y-"1 O)+"1/(i.3)*/X-"1 O
)

cube=: 3 :0
plan=:4 3$V,FRONT,V,LEFT,TOP,V,V,BACK,RIGHT,V,BASE,V
paint=:,/,/>,"_1 each/"1 C=:face each plan
paint viewmat i.12 9
)

cube ''

Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Linda Alvord
Sent: Tuesday, July 28, 2015 3:05 PM
To: [email protected]
Subject: Re: [Jprogramming] Trouble making patter for a color cube

Here's my latest which folds so the base has blue riht, red forward and
green up. Then the upper right front corner is white. 

load 'viewmat'
ColorCube=: 3 : 0
N=:y
G=:<.(i.N)*255%<: N
A=:#:i.8
B=:(((<:N)#0),G),.G,(<:N)#255
BIGBOX=:<"2(|."2)1 0 2{"1(|:"2)(8 3 ,<:2*N)$,|:(,A){"1 B 'BLACK BLUE RED
MAGENTA GREEN CYAN YELLOW WHITE'=:>BIGBOX
LYELLOW=:(i.N){"2 YELLOW
LCYAN=:(i.N){"2  CYAN
LMAGENTA=:(i.N){"2 MAGENTA
   GREEN=:((<:N)+i.N){"2 GREEN
RED=:((<:N)+i.N){"2 RED
BLUE=:((<:N)+i.N){"2 BLUE
BACK=:((*:N), 3)$,LMAGENTA<."1/LYELLOW
TOP=:((*:N), 3)$,LCYAN<."1/LYELLOW
LEFT=:((*:N), 3)$,LMAGENTA<."1/LCYAN
FRONT=:((*:N), 3)$,GREEN+"1/BLUE
RIGHT=:((*:N), 3)$,GREEN+"1/RED
BASE=:((*:N), 3)$,RED+"1/BLUE
F=:i.2#N
T=:(<:6*N^2),((<:N),N)$0
L=:|:T
R=:|:|.T
WOW1=:(R,.(|.F),.L),((|:|.(N^2)+F),.((2*N^2)+F),.|.T)

WOW2=:WOW1,(T,.((3*N^2)+F),.|:|.|:(4*N^2)+F)
WOW3=:WOW2,(R,.(|.(5*N^2)+F),.L),"2,N(#"0) 0, (6*N^2), 0
ALL=:BACK,LEFT,TOP,FRONT,RIGHT,BASE(,"2)0 0 0 ALL viewmat WOW3;'Color Cube'
)

ColorCube 30

I think only one line wrapped.  Another email follows With Raul's style
which I can't generalize to nxn squares.  

Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of David Lambert
Sent: Tuesday, July 28, 2015 1:09 PM
To: programming <[email protected]>
Subject: Re: [Jprogramming] Trouble making patter for a color cube

This delightful color cube!  I rotated one of the arms so the pattern won't
look like a cross, which is beside the point.

Has anyone yet virtually folded the image for display in perspective on
opengl?  I need a color chooser and this looks more fun than a flat display.
With 5% probability I'll undertake the task but as it happens my
understanding of homogeneous coordinates doesn't translate directly to
"knowing how to use opengl".

    boxdraw_j_ 1

    4 3$<'  ' NB. with simple editing, fixed width font please
    +--+
    |  |
+--+--+
|  |  |
+--+--+--+
    |  |  |
    +--+--+
    |  |
    +--+

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

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

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

Reply via email to