Article View: comp.lang.postscript
Article #4137Re: Exactly What does a Transformation Matrix Do?
From: Dick Dunn
Date: Tue, 13 Oct 1992 06:43
Date: Tue, 13 Oct 1992 06:43
34 lines
2048 bytes
2048 bytes
pandit@ssd.intel.com writes: >Can some one explain exactly what each element of a six-element >transformation matrix does? I was under the impression it worked as follows: > >x y [a b c d e f] transform --> x' y' > >where x' = ax + b + cy and y' = dy + e + fx. No--you've got the right idea, but the coefficients are in the wrong place. Given your transformation matrix [a b c d e f], and your input coordinates x and y, the transformation gives output coordinates x' y' as: x' = ax + cy + e y' = bx + dy + f In terms of matrix multiplication, the user coordinates are shorthand for the vector [ x y 1 ] and the 6-element CTM is shorthand for the 3x3 matrix | a b 0 | | c d 0 | | e f 1 | "Transformation" is a multiplication of the vector by the matrix (in that order!) giving the new vector [ x' y' 1 ] . As long as the subject has come up, a digression/caution: Realize that operators which modify the CTM (scale, translate, rotate, which are special cases of concat) do so by pre-multiplying the new transformation with the existing CTM. The default CTM for a device invariably incorporates nonzero translations (e,f above), scaling (a,b,c,d will be other than 0 or 1), and sometimes reflections and/or rotations. The CTM doesn't enter into what you sketched, since you used an explicit matrix with the transform operator...but if you omit the matrix you'll see the effects of the CTM. -- Dick Dunn rcd@raven.eklektix.com -or- raven!rcd Boulder, Colorado ...Never offend with style when you can offend with substance.
Technical Details
Message-ID:
<1992Oct13.064350@eklektix.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!wupost!spool.mu.edu!sol.ctr.columbia.edu!hamblin.math.byu.edu!hellgate.utah.edu!csn!raven!rcdReferences:
<1992Oct12.162054.322@iWarp.intel.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.postscript Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!wupost!spool.mu.edu!sol.ctr.columbia.edu!hamblin.math.byu.edu!hellgate.utah.edu!csn!raven!rcd From: rcd@raven.eklektix.com (Dick Dunn) Subject: Re: Exactly What does a Transformation Matrix Do? Message-ID: <1992Oct13.064350@eklektix.com> Organization: eklektix - Boulder, Colorado References: <1992Oct12.162054.322@iWarp.intel.com> Date: Tue, 13 Oct 1992 06:43:50 GMT Lines: 34