This a "Color Cube. It should print in color. And then you cut it out and fold it up and you have a little cube with pretty colors that will show you lots of things about how light makescolors. Myc cube will only have 125 colors, but it becomes infinite in your imagination.
However, I will give some thought to what you sent. This is why the forum is such fun. Each person tackles a problem in a different way. Linda -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Raul Miller Sent: Saturday, June 13, 2015 1:00 AM To: Programming forum Subject: Re: [Jprogramming] Trouble making patter for a color cube I got a lot of squares running your script, and the one that I really liked was the one that was labeled 'TOP'. So I'll base my implementation on that one. For something as complicated as this, I think I'd like to sketch out first how it's supposed to look. So here's my first sketch: (<'BASE')(<3 1)}(<'FRONT')(<2 1)}(;:'LEFT TOP RIGHT')1}(<'BACK')(<0 1)}4 3$a: (beware line wrap - that's supposed to be a single line). But I also need to think about colors. After a little fiddling, I decided to go with this: TOP=:<,.'TOP';<2 2$;:'BLACK BLUE RED MAGENTA' BACK=:<,.'BACK';<2 2$;:'GREEN CYAN BLACK BLUE' FRONT=:<,.'FRONT';<2 2$;:'RED MAGENTA YELLOW WHITE' BASE=:<,.'BASE';<2 2$;:'YELLOW WHITE GREEN CYAN' LEFT=:<,.'LEFT';<2 2$;:'BLACK RED GREEN YELLOW' RIGHT=:<,.'RIGHT';<2 2$;:'MAGENTA BLUE WHITE CYAN' BASE(<3 1)}FRONT(<2 1)}(LEFT,TOP,RIGHT)1}BACK(<0 1)}4 3$a: with that out of the way, all I need is a routine to render squares, the rest of the code almost writes itself: 'BLACK BLUE GREEN CYAN RED MAGENTA YELLOW WHITE'=:#:i.8 square=:4 :0 'O X Y'=. y colors=. <.255*O+"1,/0.25*((i.5)*/Y-"1 O)+"1/(i.5)*/X-"1 O colors viewmat (i.5 5);x ) 'BACK' square GREEN;CYAN;BLACK 'LEFT' square BLACK;RED;GREEN 'TOP' square BLACK;BLUE;RED 'RIGHT' square MAGENTA;BLUE;WHITE 'FRONT' square RED;MAGENTA;YELLOW 'BASE' square YELLOW;WHITE;GREEN Good enough? Thanks, -- Raul On Sat, Jun 13, 2015 at 12:04 AM, Linda Alvord <[email protected]> wrote: > I am planning to begin a review of J Tech Grade 3 before introducing some > new topics in Grade 4. I am making a pattern which could be printed and then > folded to form a color cube. It requires three dimensions for the three > colors of light, Green, Red and Blue. I have the colors following the > order of counting to 8 in base 2. The columns in the binary array represent > Green, Red and then Blue. This insures that the falues are in order from > dark to light. > > > > The pattern must have six sides. All went well with the first 4 sides, > However the final two sides don't cooperate. I suspect there is some little > problem in viewmat. Here is my progress so far. The front and the bottom are > the problems. They both involve YELLOW. > > > > As is usual I welcome ways you may know to improve what I am trying to do. I > suggest using JHS to see how this is progressing. > > > > load 'viewmat' > > N=:<.63.8*i.5 > > BLACK=:9 3$0 > > BLUE=:(2#"1,.(4#0),N),.N,4#255 > > RED=:(N,4#255),.2#"1,.(4#0),N > > MAGENTA=:(N,4#255),.((4#0),N),.N,4#255 > > GREEN=:((4#0),N),.(N,4#255),.(4#0),N > > CYAN=:((4#0),N),.2#"1 ,.N,4#255 > > YELLOW=:(2#"1 ,.N,4#255) ,.(4#0),N > > WHITE=:9 3$255 > > (#:i.8);'BLACK','BLUE','RED','MAGENTA','GREEN','CYAN','YELLOW',:'WHITE' > > > > A=:<.0.5*(i.5 5)+i.5 5 > > > > BLANK=:25 3$255 > > BACK=:25 3$,><"1 (0 1 2 3 4{GREEN)+"1/(0 1 2 3 4){BLUE > > BACK viewmat A > > (BACK,BLANK)viewmat (25+A),.|.A > > > > TOP=:25 3$,><"1 (0 1 2 3 4{RED)+"1/(0 1 2 3 4){BLUE > > TOP viewmat A;'TOP' > > LEFT=:25 3$,><"1 (0 1 2 3 4{GREEN)+"1/(0 1 2 3 4){RED > > LEFT viewmat A > > (TOP,LEFT) viewmat (25+|:|.A),.A > > > > ((TOP,LEFT) viewmat (25+|:|.A),.A),.(BACK,BLANK)viewmat (25+A),.|.A > > > > RIGHT=:R=:25 3$,><"1 P=:(8 7 6 5 4{CYAN)+"1/(8 7 6 5 4){MAGENTA > > RIGHT viewmat A > > > > FRONT=:S=:25 3$,><"1 Q=:(8 7 6 5 4{YELLOW)+"1/(8 7 6 5 4){MAGENTA > > FRONT viewmat A > > > > BOTTOM=:25 3$,><"1 (8 7 6 5 4{CYAN)+"1/(8 7 6 5 4){YELLOW > > BOTTOM viewmat A > > > > R;S > > > > I included R;S to show how close the good and the bad faces are prior to > using viewmat. > > > > Linda > > > > ---------------------------------------------------------------------- > 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
