Article View: comp.lang.postscript
Article #2152invertmatrix
From: Greg Couch
Date: Thu, 03 May 1990 00:05
Date: Thu, 03 May 1990 00:05
37 lines
1690 bytes
1690 bytes
In article <5903@amelia.nas.nasa.gov> izen@amelia.nas.nasa.gov (Prof. Steven H. Izen) writes:
>If anyone wants to implement a version of invertmatrix for us SGI users,
>please post it.
I posted this before (April 1989) in comp.windows.news and since 4sight is
close to NeWS 1.1, this should work for SGI users too.
- Greg Couch
gregc@cgl.ucsf.edu
%!
% The following is an implementation of the PostScript invertmatrix for NeWS.
% No copyright allowed. Greg Couch, UCSF Computer Graphic Lab, April 1989
%
% [ a b c d x y ] ->
% [ d -b -c a (cy - dx) -(ay - bx) ] / (ad - bc)
systemdict /invertmatrix known not {
systemdict
/invertmatrix { % matrix1 matrix2 invertmatrix matrix2
7 dict begin
exch aload pop % m2 a b c d x y
/y exch def /x exch def % m2 a b c d
/d exch def /c exch def % m2 a b
/b exch def /a exch def % m2
/t a d mul b c mul sub def % t = ad - bc
d t div % m2 a2
b neg t div % m2 a2 b2
c neg t div % m2 a2 b2 c2
a t div % m2 a2 b2 c2 d2
c y mul d x mul sub t div % m2 a2 b2 c2 d2 x2
b x mul a y mul sub t div % m2 a2 b2 c2 d2 x2 y2
7 -1 roll % a2 b2 c2 d2 x2 y2 m2
astore % m2
end
} put
} if
Technical Details
Message-ID:
<13887@cgl.ucsf.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!sdd.hp.com!ucsd!ucbvax!ucsfcgl!gregcReferences:
<@tfd.UUCP> <5903@amelia.nas.nasa.gov>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!sdd.hp.com!ucsd!ucbvax!ucsfcgl!gregc From: gregc@cgl.ucsf.edu (Greg Couch) Newsgroups: comp.lang.postscript Subject: invertmatrix Message-ID: <13887@cgl.ucsf.EDU> Date: 3 May 90 00:05:37 GMT References: <@tfd.UUCP> <5903@amelia.nas.nasa.gov> Sender: daemon@cgl.ucsf.edu Reply-To: gregc@cgl.ucsf.edu.UUCP (Greg Couch) Organization: Computer Graphics Lab, UCSF Lines: 37