cosic.rescue
clone your own copy | download snapshot

Snapshots | iceberg

Inside this repository

moire-effect-figure-extract.ps
application/postscript

Download raw (9.3 KB)

%!PS-Adobe-3.0

/dim 200 def		% dimensions of the screen in centiinches
/dim2 100 def		% dim/2


/myrand {rand 2147483647 div 2 mul 1 sub} def	% random number between -1...1

/figa {
    /theta1 0 def % mesure of an angle
    /theta2 0 def

    /rot 0 def		% general rotation to prevent printer artifacts

    /p1 3 def		% period for first (reference) dot screen
    /p2 3 def		% period for second dot screen

    /p1y 3 def		% period for first (reference) dot screen
    /p2y 3 def		% period for second dot screen

    /xmax 3 def	% the x axis units will be scaled before applying the mappings so
            % that the max. axis value becomes "xmax units" rather than "dim2 ci".
    /ymax 3 def	% the y axis units will be scaled before applying the mappings so
            % that the max. axis value becomes "ymax units" rather than "dim2 ci".

    /rr 1 def	% random numbers will be generated in the range -rr...rr
                % (in PostScript points!)

    % draw first (reference) dot screen:

    8 srand		% seed for rand

    /y dim2 neg def

    gsave
    theta1 rot add rotate
    gsave
    0 p1y dim {		% draw horizontal lines of dots
        newpath
        /x dim2 neg def
        /ysave exch dim2 p1y div round p1y mul sub def
        0 p1 dim	% draw a horizontal line of dots
            {/xsave exch dim2 p1 div round p1 mul sub def
            /x1 x dim2 div xmax mul def
            /y1 y dim2 div ymax mul def
            xsave x sub
            x 2 x1 mul y1 mul 0.5 mul add				% g1(x,y)
            add
            myrand rr mul sub 

            ysave y sub
            y y1 y1 mul x1 x1 mul sub 0.5 mul add			% g2(x,y)
            add 
            myrand rr mul sub moveto
            0 0 rlineto
            /x x p1 add def
        } for
        stroke
        /y y p1y add def
    } for
    grestore
    grestore


    % draw second dot screen:

    8 srand		% same seed for rand


    /y dim2 neg def

    gsave
    theta2 rot add rotate
    0 p2y dim { % draw horizontal lines of dots
        newpath
        /x dim2 neg def
        /ysave exch dim2 p2y div round p2y mul sub def
        0 p2 dim {	% draw a horizontal line of dots
            /xsave exch dim2 p2 div round p2 mul sub def
            /x1 x dim2 div xmax mul def
            /y1 y dim2 div ymax mul def
            xsave x sub
            x 2 x1 mul y1 mul 0.5 mul sub				% g3(x,y)
            add
            myrand rr mul sub 

            ysave y sub
            y y1 y1 mul x1 x1 mul sub 0.5 mul sub			% g4(x,y)
            add
            myrand rr mul sub moveto
            0 0 rlineto
            /x x p2 add def
        } for
    %	stroke
        /y y p2y add def
    } for
    grestore

} def

/figb {             % Figure B
    /theta1 0 def
    /theta2 0 def

    /rot 0 def		% general rotation to prevent printer artifacts

    /p1 3 def		% period for first (reference) dot screen
    /p2 3 def		% period for second dot screen

    /p1y 3 def		% period for first (reference) dot screen
    /p2y 3 def		% period for second dot screen

    /xmax 3 def	% the x axis units will be scaled before applying the mappings so
            % that the max. axis value becomes "xmax units" rather than "dim2 ci".
    /ymax 3 def	% the y axis units will be scaled before applying the mappings so
            % that the max. axis value becomes "ymax units" rather than "dim2 ci".

    /rr 0 def	% random numbers will be generated in the range -rr...rr
            % (in PostScript points!)


    % draw first (reference) dot screen:

    8 srand		% seed for rand


    /y dim2 neg def

    gsave
    theta1 rot add rotate
    gsave
    0 p1y dim		% draw horizontal lines
    {newpath
        /x dim2 neg def
        /ysave exch dim2 p1y div round p1y mul sub def
        0 p1 dim	% draw a horizontal line of dots
            {/xsave exch dim2 p1 div round p1 mul sub def
            /x1 x dim2 div xmax mul def
            /y1 y dim2 div ymax mul def
            xsave x sub
            x 2 x1 mul y1 mul 0.5 mul add				% g1(x,y)
            add
            myrand rr mul sub 

            ysave y sub
            y y1 y1 mul x1 x1 mul sub 0.5 mul add			% g2(x,y)
            add 
            myrand rr mul sub moveto
            0 0 rlineto
            /x x p1 add def
        } for
        stroke
        /y y p1y add def
    } for
    grestore
    grestore


    % draw second dot screen:

    8 srand		% same seed for rand


    /y dim2 neg def

    gsave
    theta2 rot add rotate
    0 p2y dim		% draw horizontal lines of dots
    {newpath
        /x dim2 neg def
        /ysave exch dim2 p2y div round p2y mul sub def
        0 p2 dim	% draw a horizontal line of dots
            {/xsave exch dim2 p2 div round p2 mul sub def
            /x1 x dim2 div xmax mul def
            /y1 y dim2 div ymax mul def
            xsave x sub
            x 2 x1 mul y1 mul 0.5 mul sub				% g3(x,y)
            add
            myrand rr mul sub 

            ysave y sub
            y y1 y1 mul x1 x1 mul sub 0.5 mul sub			% g4(x,y)
            add 
            myrand rr mul sub moveto
            0 0 rlineto
            /x x p2 add def
        } for
    %	stroke
        /y y p2y add def
    } for
    grestore

} def


% ************************************** Fig. (c):

/figc {
/theta1 0 def
/theta2 0 def

/rot 0 def		% general rotation to prevent printer artifacts

/p1 3 def		% period for first (reference) dot screen
/p2 3 def		% period for second dot screen

/p1y 3 def		% period for first (reference) dot screen
/p2y 3 def		% period for second dot screen

/xmax 3 180 mul def	% the x axis units will be scaled before applying the mappings so
		% that the max. axis value becomes "xmax units" rather than "dim2 ci".
/ymax 0.1 dim2 mul def	% the y axis units will be scaled before applying the mappings so
		% that the max. axis value becomes "ymax units" rather than "dim2 ci".

/rr 1 def	% random numbers will be generated in the range -rr...rr
		% (in PostScript points!)


% draw first (reference) dot screen:

8 srand		% seed for rand


/y dim2 neg def

gsave
theta1 rot add rotate
gsave
0 p1y dim		% draw horizontal lines of dots
{newpath
	/x dim2 neg def
	/ysave exch dim2 p1y div round p1y mul sub def
	0 p1 dim	% draw a horizontal line of dots
		{/xsave exch dim2 p1 div round p1 mul sub def
		/x1 x dim2 div xmax mul def
		/y1 y dim2 div ymax mul def
		xsave x sub
		x y1 0.5 mul add					% g1(x,y)
		add
		myrand rr mul sub 

		ysave y sub
		y x1 sin neg 0.5 mul add				% g2(x,y)
		add 
		myrand rr mul sub moveto
		0 0 rlineto
		/x x p1 add def
	} for
	stroke
	/y y p1y add def
} for
grestore
grestore


% draw second dot screen:

8 srand		% same seed for rand


/y dim2 neg def

gsave
theta2 rot add rotate
0 p2y dim		% draw horizontal lines of dots
{newpath
	/x dim2 neg def
	/ysave exch dim2 p2y div round p2y mul sub def
	0 p2 dim	% draw a horizontal line of dots
		{/xsave exch dim2 p2 div round p2 mul sub def
		/x1 x dim2 div xmax mul def
		/y1 y dim2 div ymax mul def
		xsave x sub
		x y1 0.5 mul sub					% g3(x,y)
		add
		myrand rr mul sub 

		ysave y sub
		y x1 sin neg 0.5 mul sub				% g4(x,y)
		add 
		myrand rr mul sub moveto
		0 0 rlineto
		/x x p2 add def
	} for
%	stroke
	/y y p2y add def
} for
grestore
} def




% ****************************************** Fig. (d):

/figd {

/theta1 0 def
/theta2 0 def

/rot 0 def		% general rotation to prevent printer artifacts

/p1 3 def		% period for first (reference) dot screen
/p2 3 def		% period for second dot screen

/p1y 3 def		% period for first (reference) dot screen
/p2y 3 def		% period for second dot screen

/xmax 3 180 mul def	% the x axis units will be scaled before applying the mappings so
		% that the max. axis value becomes "xmax units" rather than "dim2 ci".
/ymax 0.1 dim2 mul def	% the y axis units will be scaled before applying the mappings so
		% that the max. axis value becomes "ymax units" rather than "dim2 ci".

/rr 0 def	% random numbers will be generated in the range -rr...rr
		% (in PostScript points!)


% draw first (reference) dot screen:

8 srand		% seed for rand


/y dim2 neg def

gsave
theta1 rot add rotate
gsave
0 p1y dim		% draw horizontal lines of dots
{newpath
	/x dim2 neg def
	/ysave exch dim2 p1y div round p1y mul sub def
	0 p1 dim	% draw a horizontal line of dots
		{/xsave exch dim2 p1 div round p1 mul sub def
		/x1 x dim2 div xmax mul def
		/y1 y dim2 div ymax mul def
		xsave x sub
		x y1 0.5 mul add					% g1(x,y)
		add
		myrand rr mul sub 

		ysave y sub
		y x1 sin neg 0.5 mul add				% g2(x,y)
		add 
		myrand rr mul sub moveto
		0 0 rlineto
		/x x p1 add def
	} for
	stroke
	/y y p1y add def
} for
grestore
grestore


% % draw second dot screen:
% 
% 8 srand		% same seed for rand
% 
% 
% /y dim2 neg def
% 
% gsave
% theta2 rot add rotate
% 0 p2y dim {     % draw horizontal lines of dots
%     newpath
% 	/x dim2 neg def
% 	/ysave exch dim2 p2y div round p2y mul sub def
% 	0 p2 dim	% draw a horizontal line of dots
% 		{/xsave exch dim2 p2 div round p2 mul sub def
% 		/x1 x dim2 div xmax mul def
% 		/y1 y dim2 div ymax mul def
% 		xsave x sub
% 		x y1 0.5 mul sub					% g3(x,y)
% 		add
% 		myrand rr mul sub 
% 
% 		ysave y sub
% 		y x1 sin neg 0.5 mul sub				% g4(x,y)
% 		add 
% 		myrand rr mul sub moveto
% 		0 0 rlineto
% 		/x x p2 add def
% 	} for
%     %stroke
% 	/y y p2y add def
% } for
% grestore
} def


1 setlinewidth
1 setlinecap


300 300 translate


%newpath 0 0 100 0 360 arc closepath clip
%figb
%9 rotate
figd
%1 setgray
%newpath 0 0 25 0 360 arc closepath fill



showpage