I do not have your image files (PLUS.png, TOP.png, SIDE.png, BLEND.png) so this does not work for me.
I guess this is a generic problem with coding - you get something to work and you show it to someone else and then you realize they need something else to get it to run (or, worse, you don't realize that until later when someone shows you it's broken). We try to solve this problem in various ways (type systems and logging and error handling an so on), but ultimately we can't evade the fact that (a) sometimes we make mistakes, and (b) we need to keep on trying on until we get things right. (Or not, I guess - though that can be a serious problem.) Thanks, -- Raul On Sun, Jun 14, 2015 at 2:38 AM, Linda Alvord <[email protected]> wrote: > Here's an idea I'm using to blend two colors. In this new problem, I want to > take advantage of the fact that a list of graded shades of blue and a list > of shades of red form a table that produces magenta. > > You are using three colors to make each face. > > It is interesting that shades of cyan and shades of magenta wwill produce > red. > > Can you incorporate that in your design? > > Here's how I demonstrated it. > > In this new color cube I am trying to stay with the same idea. > > As you can see, I ran into trouble with YELLOW. > > load 'viewmat' > > VISIBLE_jviewmat_=:GUI_jviewmat_=:0 > RGB=:0 255{~#:i.8 > GRB=:1 0 2{"1 RGB > RGB;GRB > GRB viewmat (-.0=*/~i:4);'PLUS' > GRB viewmat (8 8$i.8);'TOP' > GRB viewmat (|:8 8$i.8);'SIDE' > A=:<.0.5*(i.8 8)+|:i.8 8 > B=:(i.8)<:/i.8 > C=:63*(i.8)>/i.8 > GRB viewmat (C+B*A);'BLEND' > VISIBLE_jviewmat_=:GUI_jviewmat_=:1 > > coclass 'qtdemo' > blendcolor_run=: 3 : 0 > wd 'pc imdemo closeok escclose' > wd 'grid size 2 2' > wd 'cc pic image' > wd 'cc png1 image' > wd 'cc png2 image' > wd 'cc png3 image' > wd 'set pic image *' ,jpath '~temp/PLUS.png' > wd 'set png1 image *', jpath '~temp/TOP.png' > wd 'set png2 image *', jpath '~temp/SIDE.png' > wd 'set png3 image *', jpath '~temp/BLEND.png' > wd 'pshow' > ) > > blendcolor_close=: 3 : 0 > wd 'pclose' > ) > > blendcolor_run'' > > Linda > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Linda Alvord > Sent: Sunday, June 14, 2015 2:02 AM > To: [email protected] > Subject: Re: [Jprogramming] Trouble making patter for a color cube > > This time I get an error after a large image of color stripes from red to > blue. > > cube'' > |value error: BLACK > | colors viewmat i.20 15 > > I'm not sure how to fix it. > > Linda > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Raul Miller > Sent: Saturday, June 13, 2015 10:00 AM > To: Programming forum > Subject: Re: [Jprogramming] Trouble making patter for a color cube > > Ok, fair enough. > > New plan: > > 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$;:'GREEN BLACK RED YELLOW' > RIGHT=:<,.'RIGHT';<2 2$;:'BLUE CYAN MAGENTA WHITE' > BASE(<3 1)}FRONT(<2 1)}(LEFT,TOP,RIGHT)1}BACK(<0 1)}4 3$a: > > Implementation: > > 'BLANK'=: <BLACK;BLACK;BLACK > 'BACK'=: <GREEN;CYAN;BLACK > 'LEFT'=: <GREEN;BLACK;YELLOW > 'TOP'=: <BLACK;BLUE;RED > 'RIGHT'=: <BLUE;CYAN;MAGENTA > 'FRONT'=: <RED;MAGENTA;YELLOW > 'BASE'=: <YELLOW;WHITE;GREEN > > squarecolor=:3 :0 > 'O X Y'=. y > colors=. <.255*O+"1]0.25*((i.5)*/Y-"1 O)+"1/(i.5)*/X-"1 O > ) > > cube=:3 :0 > plan=: BASE(<3 1)}FRONT(<2 1)}(LEFT,TOP,RIGHT)1}BACK(<0 1)}4 3$BLANK > ref=. ((75*i.4)+/5*i.3) +each <i.5 5 > colors=. ,/,/>,"_1 each/"1 squarecolor each plan > colors viewmat i.20 15 > ) > > cube'' > > Technically, I didn't need to quote my color names, but I decided to leave > the quotes in as emphasis (or, perhaps more accurately, to give some style > to those particular names). > > Thanks, > > -- > Raul > > > On Sat, Jun 13, 2015 at 5:11 AM, Linda Alvord <[email protected]> > wrote: >> Raul, I can see that a plan is useful. If you think of Black as no light. >> Now build three axes. Blue is to the right (0 to 255). Red is forward > toward >> you. And green moves up from the base. So >> >> I like your floor plan, Now LEFT and RIGHT are not oriented correctly. >> >> Try your code in JHS. There you can just place the images where you >> want them. >> >> Linda >> >> -----Original Message----- >> From: [email protected] >> [mailto:[email protected]] On Behalf Of Linda > Alvord >> Sent: Saturday, June 13, 2015 4:40 AM >> To: [email protected] >> Subject: Re: [Jprogramming] Trouble making patter for a color cube >> >> Also, when I ran your code in jqt, I separated the separate images >> and > they >> work together. However they are a horizontal flip of your layout for >> the pieces. Linda >> >> -----Original Message----- >> From: [email protected] >> [mailto:[email protected]] On Behalf Of Linda > Alvord >> Sent: Saturday, June 13, 2015 4:25 AM >> To: [email protected] >> Subject: Re: [Jprogramming] Trouble making patter for a color cube >> >> Raul, I got an error after you layout appeared. Now that I removed >> that line, I got your six images. They are correct Now put them into >> your > layout >> pattern so that the correct colors are joined. And make one big image >> with the correct sides joined. >> >> It still bothers me that two of the faces in my work aren't correct. >> Now > on >> to study your strategy. Linda >> >> -----Original Message----- >> From: [email protected] >> [mailto:[email protected]] On Behalf Of Linda > Alvord >> Sent: Saturday, June 13, 2015 3:21 AM >> To: [email protected] >> Subject: Re: [Jprogramming] Trouble making patter for a color cube >> >> 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 >> >> ---------------------------------------------------------------------- >> 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 > ---------------------------------------------------------------------- > 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
