Monday, May 26, 2008

Assignment #4, Q 17

To do this question...imagine that you have a sheet of paper divided into 12 squares...

You want to make a 'net' of a colour cube which looks like a 'cross' on your sheet of paper.

If your paper is facing you so that its height is 3 squares and its width is 4 squares, then you need to have the following colours looking back at you 'going 'left to right' and 'top to bottom': (white, CM, white, white), (RB, YM, CY, GB), (white, RG, white, white).

To make the colour 'white' you need to 'turn on the R, G, and B channels'. I have indicated the 'white' regions as WA, WB, ... , WF.

Starting from scratch...the octave commands are:

RB(:,:,1)=[ones(256,1)*[0:1:255]/255];
RB(:,:,2)=[zeros(256)];
RB(:,:,3)=[ones(256,1)*[0:1:255]/255]';
RB=rotdim(RB, 270);

RG(:,:,1)=[ones(256,1)*[0:1:255]/255]';
RG(:,:,2)=[ones(256,1)*[0:1:255]/255];
RG(:,:,3)=zeros(256);

GB(:,:,1)=zeros(256);
GB(:,:,2)=[ones(256,1)*[0:1:255]/255];
GB(:,:,3)=[ones(256,1)*[255:1:0]/255]';
GB=rotdim(GB, 270);

CY(:,:,1)=[ones(256,1)*[0:1:255]/255];
CY(:,:,2)=ones(256);
CY(:,:,3)=[ones(256,1)*[0:1:255]/255]';

YM(:,:,1)=ones(256);
YM(:,:,2)=[ones(256,1)*[0:1:255]/255]';
YM(:,:,3)=[ones(256,1)*[0:1:255]/255];

CM(:,:,1)=[ones(256,1)*[0:1:255]/255]';
CM(:,:,2)=[ones(256,1)*[0:1:255]/255];
CM(:,:,3)=ones(256);

WA(:,:,1)=ones(256);
WA(:,:,2)=ones(256);
WA(:,:,3)=ones(256);

WB(:,:,1)=ones(256);
WB(:,:,2)=ones(256);
WB(:,:,3)=ones(256);

WC(:,:,1)=ones(256);
WC(:,:,2)=ones(256);
WC(:,:,3)=ones(256);

WD(:,:,1)=ones(256);
WD(:,:,2)=ones(256);
WD(:,:,3)=ones(256);

WE(:,:,1)=ones(256);
WE(:,:,2)=ones(256);
WE(:,:,3)=ones(256);

WF(:,:,1)=ones(256);
WF(:,:,2)=ones(256);
WF(:,:,3)=ones(256);

Net=[WA,CM,WB,WC;RB,YM,CY,GB;WD,RG,WE,WF];

imshow(Net)

No comments: