Raul, Here's my "real" question. Viewmat knows a pattern to find WHAT IS THIS
and I don't!
load 'viewmat'
]Y=:3 3$255 255 255 255 255 0 0 0 0
]Y=:3 3$255 255 255 255 255 0 0 0 0
]Y4=: 3%~+/"2 (0 0 0,0 1 1,1 1 2,:2 2 2){Y
(Y viewmat i.4)-:Y4 viewmat i.4
Y5=:4%~+/"2 ( WHAT is THIS){Y4
(Y4 viewmat i.5)-:Y5 viewmat i.5
Linda
-----Original Message-----
From: Programming [mailto:[email protected]] On Behalf
Of Linda A Alvord
Sent: Monday, January 25, 2016 9:49 AM
To: [email protected]
Subject: Re: [Jprogramming] Monday Morning Wake Up Exercise
A blank on got away. Your expression should work also on B to create a correct
B4.
Linda
-----Original Message-----
From: Programming [ <mailto:[email protected]>
mailto:[email protected]] On Behalf Of Linda A Alvord
Sent: Monday, January 25, 2016 9:46 AM
To: <mailto:[email protected]> [email protected]
Subject: Re: [Jprogramming] Monday Morning Wake Up Exercise
Your colors look good! Now can you write a J expression to convert Y into your
Y4 ?
Linda
-----Original Message-----
From: Programming [ <mailto:[email protected]>
mailto:[email protected]] On Behalf Of Raul Miller
Sent: Monday, January 25, 2016 8:28 AM
To: Programming forum
Subject: Re: [Jprogramming] Monday Morning Wake Up Exercise
Y=:3 3$255 255 255 255 255 0 0 0 0
B=:3 3$255 255 255 0 0 255 0 0 0
The four colors seen in
Y viewmat 0 1 2 3;'Y Four'
are these four colors:
]Y4=: 3%~+/"2 (0 0 0,0 1 1,1 1 2,:2 2 2){Y
255 255 255
255 255 85
170 170 0
0 0 0
To prove that to yourself, you can look at
Y4 viewmat 0 1 2 3;'Y4 Four'
and compare it with the other image.
Similarly, the four colors seen in
B viewmat 0 1 2 3;'B Four'
are
]B4=: 3%~+/"2 (0 0 0,0 1 1,1 1 2,:2 2 2){B
255 255 255
85 85 255
0 0 170
0 0 0
Does that make sense?
Does my explanation in my previous message make more sense now?
Thanks,
--
Raul
On Mon, Jan 25, 2016 at 4:42 AM, Linda A Alvord <
<mailto:[email protected]> [email protected]>
wrote:
> A single color is a triple of integers 0 to 255. There are four new
> colors. Two yellow and two blue. What are the four colors?
>
> Linda
>
> -----Original Message-----
> From: Programming [ <mailto:[email protected]>
> mailto:[email protected]] On
> Behalf Of Raul Miller
> Sent: Monday, January 25, 2016 2:52 AM
> To: Programming forum
> Subject: Re: [Jprogramming] Monday Morning Wake Up Exercise
>
> You can replace Y with Y4 and B with Y4 in those two expressions:
>
> Y4=: 3%~+/"2 (0 0 0,0 1 1,1 1 2,:2 2 2){Y
> B4=: 3%~+/"2 (0 0 0,0 1 1,1 1 2,:2 2 2){B
>
> In other words, viewmat is interpolating linearly. (Pretend that the three
> colors in Y are on a line segment and then pick four points equal spaced
> apart with the two endpoints on the edges of that line segment. For the
> other two colors use a weighted average of the two surrounding colors with
> the weights being how close each point is to the corresponding color.)
>
> Thanks,
>
> --
> Raul
>
>
> On Mon, Jan 25, 2016 at 2:26 AM, Linda A Alvord <
> <mailto:[email protected]> [email protected]>
> wrote:
>
> > This code makes 8 images. What are the two middle colors in 'Y Four' and
> > the
> > two colors in 'B Four'?
> >
> >
> >
> > load 'viewmat'
> >
> > ]Y=:3 3$255 255 255 255 255 0 0 0 0
> >
> > Y viewmat 0;'Y One'
> >
> > Y viewmat 0 1;'Y Two'
> >
> > Y viewmat 0 1 2;'Y Three'
> >
> > Y viewmat 0 1 2 3;'Y Four'
> >
> > ]B=:3 3$255 255 255 0 0 255 0 0 0
> >
> > B viewmat 0;'B One'
> >
> > B viewmat 0 1;'B Two'
> >
> > B viewmat 0 1 2;'B Three'
> >
> > B viewmat 0 1 2 3;'B Four'
> >
> >
> >
> > Linda
> >
> > ----------------------------------------------------------------------
> > For information about J forums see <http://www.jsoftware.com/forums.htm>
> > http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see <http://www.jsoftware.com/forums.htm>
> http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see <http://www.jsoftware.com/forums.htm>
> http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see <http://www.jsoftware.com/forums.htm>
http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see <http://www.jsoftware.com/forums.htm>
http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see <http://www.jsoftware.com/forums.htm>
http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm