There are values in S and T that larger than 255, will it be an issue? On Jun 15, 2015 10:35 AM, "Linda Alvord" <[email protected]> wrote:
> Raul, Now can I convince you that there is a problem with viewmat. > Shouldn't > the two arrays R and S both work correctly? > > load 'viewmat' > N=:<.63.8*i.5 > MAGENTA=:(N,4#255),.((4#0),N),.N,4#255 > YELLOW=:(2#"1 ,.N,4#255) ,.(4#0),N > CYAN=:((4#0),N),.2#"1 ,.N,4#255 > A=:<.0.5*(i.9 9)+i.9 9 > S=:81 3$,><"1 (|.YELLOW)+"1/|.MAGENTA > S viewmat A > T=:81 3$,><"1 (|.CYAN)+"1/|.MAGENTA > T viewmat A > > S;T > ------------T-----------┐ > │510 510 510│510 510 510│ > │510 446 510│510 446 510│ > │510 382 510│510 382 510│ > │510 318 510│510 318 510│ > │510 255 510│510 255 510│ > │446 255 446│446 255 446│ > │382 255 382│382 255 382│ > │318 255 318│318 255 318│ > │255 255 255│255 255 255│ > │510 510 446│446 510 510│ > │510 446 446│446 446 510│ > │510 382 446│446 382 510│ > │510 318 446│446 318 510│ > │510 255 446│446 255 510│ > │446 255 382│382 255 446│ > │382 255 318│318 255 382│ > │318 255 254│254 255 318│ > │255 255 191│191 255 255│ > │510 510 382│382 510 510│ > │510 446 382│382 446 510│ > │510 382 382│382 382 510│ > │510 318 382│382 318 510│ > │510 255 382│382 255 510│ > │446 255 318│318 255 446│ > │382 255 254│254 255 382│ > │318 255 190│190 255 318│ > │255 255 127│127 255 255│ > │510 510 318│318 510 510│ > │510 446 318│318 446 510│ > │510 382 318│318 382 510│ > │510 318 318│318 318 510│ > │510 255 318│318 255 510│ > │446 255 254│254 255 446│ > │382 255 190│190 255 382│ > │318 255 126│126 255 318│ > │255 255 63│ 63 255 255│ > │510 510 255│255 510 510│ > │510 446 255│255 446 510│ > │510 382 255│255 382 510│ > │510 318 255│255 318 510│ > │510 255 255│255 255 510│ > │446 255 191│191 255 446│ > │382 255 127│127 255 382│ > │318 255 63│ 63 255 318│ > │255 255 0│ 0 255 255│ > │446 446 255│255 446 446│ > │446 382 255│255 382 446│ > │446 318 255│255 318 446│ > │446 254 255│255 254 446│ > │446 191 255│255 191 446│ > │382 191 191│191 191 382│ > │318 191 127│127 191 318│ > │254 191 63│ 63 191 254│ > │191 191 0│ 0 191 191│ > │382 382 255│255 382 382│ > │382 318 255│255 318 382│ > │382 254 255│255 254 382│ > │382 190 255│255 190 382│ > │382 127 255│255 127 382│ > │318 127 191│191 127 318│ > │254 127 127│127 127 254│ > │190 127 63│ 63 127 190│ > │127 127 0│ 0 127 127│ > │318 318 255│255 318 318│ > │318 254 255│255 254 318│ > │318 190 255│255 190 318│ > │318 126 255│255 126 318│ > │318 63 255│255 63 318│ > │254 63 191│191 63 254│ > │190 63 127│127 63 190│ > │126 63 63│ 63 63 126│ > │ 63 63 0│ 0 63 63│ > │255 255 255│255 255 255│ > │255 191 255│255 191 255│ > │255 127 255│255 127 255│ > │255 63 255│255 63 255│ > │255 0 255│255 0 255│ > │191 0 191│191 0 191│ > │127 0 127│127 0 127│ > │ 63 0 63│ 63 0 63│ > │ 0 0 0│ 0 0 0│ > L-----------+--------------- > > Linda > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Linda > Alvord > Sent: Sunday, June 14, 2015 8:52 PM > To: [email protected] > Subject: Re: [Jprogramming] Trouble making patter for a color cube > > Wow! It works in jgt also. I expected 6 or 7 separate images. That's > exciting. > > Linda > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Linda > Alvord > Sent: Sunday, June 14, 2015 8:41 PM > To: [email protected] > Subject: Re: [Jprogramming] Trouble making patter for a color cube > > This is exactly where I was heading! It is quite beautiful and should > "fold" > into a cube. > > I'd like to get it done "my way" and then I'll study yours and see what > will > work best for beginners. I'm hoping it will interst young children to > "build" it themselves. > > Thank you! Linda > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Raul Miller > Sent: Sunday, June 14, 2015 10:14 AM > To: Programming forum > Subject: Re: [Jprogramming] Trouble making patter for a color cube > > My apologies. > > I left out the color definition line. (Brian Schott emailed me a note about > this, privately.) > > Here's what I think you need: > > 'BLACK BLUE GREEN CYAN RED MAGENTA YELLOW WHITE'=:#:i.8 > > '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 > ) > > require'viewmat' > cube=:3 :0 > plan=: BASE(<3 1)}FRONT(<2 1)}(LEFT,TOP,RIGHT)1}BACK(<0 1)}4 3$BLANK > colors=: ,/,/>,"_1 each/"1 squarecolor each plan > colors viewmat i.20 15 > ) > > cube'' > > And, once you have that, you may want to do something like this: > > setsize_jviewmat_ 750 1000 > savemat_jviewmat_ jpath '~user/color-cube-page.png' > > Thanks, > > -- > Raul > > On Sun, Jun 14, 2015 at 2:01 AM, Linda Alvord <[email protected]> > wrote: > > 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 > > ---------------------------------------------------------------------- > 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
