Thanks,  Brian, for taking the trouble to improve the format
of my code,  and to report that it works for you.   Your copy
works for me too in a new workspace,  but only if I wrap the
long comment about transpose in "mysquarecolours" .  One
just can't win with emails!  And J was designed to avoid
APL's code communication problems,  among many other
aspirations.

Linda appears to think my approach is adding complication,
while I think it simplifies matters.  It allows one to specify
8 colours for the 8 corners without worrying whether they're
all complementary or orthogonal or whatever.

I should perhaps not have confused the issue by wittering on
about other net layouts.

Thanks again,
Mike

On 26/06/2015 21:20, Brian Schott wrote:
load'viewmat'

'BLACK BLUE GREEN CYAN RED MAGENTA YELLOW WHITE'=:#:i.8

msc=:mysquarecolours =: 3 : 0
:
nsteps =. x
'A B C D' =. y
lamda =. (,:~-.)@:(%~ i.@>:) nsteps
AB =. lamda +/@:(*/"1) A,:B NB. mix of colours between corners A & B
CD =. lamda +/@:(*/"1) D,:C NB. mix of colours between corners C & D
1 0 2 |: <.255 * lamda +/@:(*/"1) AB,:CD NB. transpose 'cos I got the order
wrong!
)
mycube=: 3 : 0
:
nsteps =. 2 >. <: x
'A B C D H G F E' =. y
BLANK =. < BLACK;BLACK;BLACK;BLACK
FRONT =. < A;B;C;D
BACK =. < H;G;F;E
TOP =. < E;F;B;A
LEFT =. < H;E;A;D
RIGHT =. < F;G;C;B
BASE =. < D;C;G;H
plan =. BASE(<3 1)}FRONT(<2 1)}(LEFT,TOP,RIGHT)1}BACK(<0 1)}4 3$BLANK
colours =. ,/,/>,"_1 each/"1 nsteps mysquarecolours each plan
colours viewmat i.($plan)*nsteps+1
)
30 mycube BLACK,BLUE,WHITE,GREEN,RED,YELLOW,CYAN,:MAGENTA


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Reply via email to