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

Reply via email to