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]] 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 <[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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

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

Reply via email to