Article View: comp.lang.postscript
Article #4138Re: Exactly What does a Transformation Matrix Do?
From: Rob Henley
Date: Tue, 13 Oct 1992 14:38
Date: Tue, 13 Oct 1992 14:38
96 lines
2343 bytes
2343 bytes
% This is something I wrote out of interest - just shows the effect of
% various transformation matrices on a "unit" 100 x 100 square
% Rob Henley, SNI UK rob@siesoft.co.uk
/Helvetica-Oblique findfont 10 scalefont setfont
0 setlinewidth
/str 20 string def
/inv matrix def
/box {
0 0 moveto
100 0 lineto
100 100 lineto
0 100 lineto
closepath fill
gsave
0 setgray
16 90 moveto 25 90 lineto 78 90 moveto 87 90 lineto
16 36 moveto 25 36 lineto 78 36 moveto 87 36 lineto
16 36 moveto 16 90 lineto 87 36 moveto 87 90 lineto
stroke
matrix currentmatrix inv matrix concatmatrix aload pop
0 2 10 {index} for
20 80 moveto 100 mul round cvi 100 div str cvs show
60 80 moveto 100 mul round cvi 100 div str cvs show
20 60 moveto 100 mul round cvi 100 div str cvs show
60 60 moveto 100 mul round cvi 100 div str cvs show
20 40 moveto 100 mul round cvi 100 div str cvs show
60 40 moveto 100 mul round cvi 100 div str cvs show
grestore
} def
% -- axes --
25 27 moveto
(O) show
30 30 translate
matrix currentmatrix inv invertmatrix
0 0 moveto
0 700 lineto
5 -10 rmoveto (700) show
0 0 moveto
500 0 lineto
-15 5 rmoveto (500) show
stroke
0.5 setgray
box
[1 0 0 1 50 50 ]
matrix currentmatrix
matrix concatmatrix
setmatrix
0.8 setgray
box
[ 30 cos 30 sin 30 sin neg 30 cos 0 0 ]
[ 1 0 0 1 100 100 ]
matrix currentmatrix
matrix concatmatrix
matrix concatmatrix
setmatrix
0.98 setgray
box
[ 1 1 0 1 0 0 ]
[ -30 cos -30 sin -30 sin neg -30 cos 0 0 ]
[ 1 0 0 1 100 100 ]
matrix currentmatrix
matrix concatmatrix
matrix concatmatrix
matrix concatmatrix
setmatrix
0.6 setgray
box
[ 1.5 0 0 1.5 0 0 ]
[ -30 cos -30 sin -30 sin neg -30 cos 0 0 ]
[ 1 0 0 1 100 100 ]
matrix currentmatrix
matrix concatmatrix
matrix concatmatrix
matrix concatmatrix
setmatrix
0.98 setgray
box
showpage
Technical Details
Message-ID:
<1992Oct13.143801.4622@siesoft.co.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!siesoft!oxygen!robReferences:
<1992Oct12.162054.322@iWarp.intel.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!siesoft!oxygen!rob From: rob@siesoft.co.uk (Rob Henley) Newsgroups: comp.lang.postscript Subject: Re: Exactly What does a Transformation Matrix Do? Message-ID: <1992Oct13.143801.4622@siesoft.co.uk> Date: 13 Oct 92 14:38:01 GMT References: <1992Oct12.162054.322@iWarp.intel.com> Sender: news@siesoft.co.uk (Usenet News) Reply-To: rob@siesoft.co.uk Organization: Siemens Nixdorf Information Systems Ltd. Lines: 96