Here's topic1 of JTECH Grade 4. This dialog blends colors of light in tables
similar to the table verb in J. The code produces three tables:

 

Table 1 blends colors by adding he three components of two GRB

colors.

 

Table 2 removes duplicates.  Green and red light is yellow.

 

Table 3 Blends yellow, cyan and magenta as paint. The colors become darker.
Yellow and magenta form red. So this explains the colors of printer ink.

 

JHS provides a continuous story as the script is run.  Instead jqt provides
three separate png's.

 

load 'viewmat'

[GRB=:|.255*1 0 2{"1 #:i.8

*/table i.5

[GRB1=:3 5 6{GRB   NB. One light

blight=: 13 :'(3,~2^~}:$y)$,255<.+"1/~y'

LPAL=:blight GRB1

[LPALS=:(3#255),LPAL,0 0 0

[T=:(|:(10 0,1 5 9),.5#0)

[B=:((,.1 5 9),.0),.>:i.3 3

LPALS viewmat T,B

t=: 13 :'>:/~>:i.y'

t 3

[TB=:(|:10 0 1 5 9,.0),(1 5 9,.0),"1(t 3)*>:i.3 3

LPALS viewmat TB

[GRB2=:1 2 4{GRB   NB. TWO lights

bpaint=: 13 :'(3,~2^~}:$y)$,0>.255-~+"1/~y'

PPAL=:bpaint GRB2

[PPALS=:(3#255),PPAL,0 0 0

PPALS viewmat TB

t

blight

bpaint

 

Linda

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

Reply via email to