|
|
Sample Programs from NeXSTEP 3.3
%!PS-Adobe-2.0 EPSF-2.0
%%Title: Rectangle.eps
%%Creator: Ali Ozer
%%CreationDate: Tue Aug 14 10:38:47 1990
%%Pages: 0 1
%%BoundingBox: -5 0 600 792
%%EndComments
% Fun with scaling and rotating...
% This program draws a rectangle over and over again while
% slightly altering the scale and rotate values by a
% fixed amount. This results in symmetric patterns.
% Author: Ali Ozer, March 1989
% Initialize the random number generator
% You can also seed the random number generator with
% a constant number to get the same pattern everytime...
usertime srand
% Random number generator
% a b randfloat generates one of 1000 numbers [a..b)
/randfloat { % start end
exch dup 3 1 roll % start end start
sub % end-start
rand 1000 mod 1000 div % 0 - 0.999
mul add
} bind def
% The drawing routine.
/drawbox {
-100 -100 200 200 rectstroke
} bind def
% Change the following for different pictures...
/xscaleAmount 0.98 1.02 randfloat def
/yscaleAmount 0.98 1.02 randfloat def
/rotateAmount -3.0 3.0 randfloat def
/numSteps 200 def
% Come up towards the middle of a 8.5x11 (default) page
72 8.5 mul 2 div 72 11 mul 2 div translate
% Have thin lines (even when scaled; 0 linewidth
% means "use the smallest line you can")
0 setlinewidth
% Take numSteps steps from 1 to 0, drawing a
% rectangle and altering the coordinate system
% by the above values at every step...
1 1 numSteps div neg 0 {
setgray
xscaleAmount yscaleAmount scale
rotateAmount rotate
drawbox
} for
%%EndFile
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.