xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject RE: Extracting information from a transformation matrix
Date Mon, 05 Jun 2006 17:38:01 GMT
Hi Michael,

"Bishop, Michael W. CONTR J9C880" <Michael.Bishop@je.jfcom.mil> wrote on 
06/05/2006 12:12:15 PM:

> Am I correct in assuming that:
> 
> transform(tx, ty) scale(sx, sy)
> 
> and
> 
> sx  0  tx
> 0   sy ty
> 
> will hold identical values for sx, sy, tx, and ty for any values of
> those variables?  In other words, no matter how I scale/translate or in
> what order, should it matter?  Note that no rotation has been
> introduced.

   Order does matter. So scale then translate is different from
translate then scale.  However since you are manipulating the
transform on one element you can play some games by choosing to
pre or post multiply the various transforms.  So if you always
post multiply the translate transform (preconcatenate in JDK
terms) then the translate part will just be 'added' to the 
existing matrix.  This is probably what you want for translate
(from what I recall of how you handle things). 


> 
> Michael Bishop
> 
> -----Original Message-----
> From: Bishop, Michael W. CONTR J9C880
> [mailto:Michael.Bishop@je.jfcom.mil] 
> Sent: Friday, June 02, 2006 12:32 PM
> To: batik-users@xmlgraphics.apache.org
> Subject: RE: Extracting information from a transformation matrix
> 
> Good, good...OK, now I'm getting an understanding and figuring out what
> needs to be done.  I assume the 6 values are represented as:
> 
> a b c
> d e f
> 0 0 1 (implied, I know we don't really care about these values)
> 
> According to my reference, to do a translation, I would have to multiply
> in the following:
> 
> 1 0 tx
> 0 1 ty
> 0 0 1 (again, implied)
> 
> A scale:
> 
> sx  0   0
> 0   sy  0
> 0   0   1 (implied for consistency's sake)
> 
> A rotate:
> 
> cos(t) -sin(t) 0
> sin(t)  cos(t) 0
> 0       0      1 (blah blah)
> 
> To get this done in code:
> 
> AffineTransform affineTransform = new AffineTransform(a, b, c, d, e, f);
> SVGMatrix svgMatrix = new SVGOMMatrix(affineTransform);
> 
> Besides the obvious way of calling getA(), getB(), etc., is there a way
> to turn this into the proper attribute?
> 
> transform="matrix(a, b, c, d, e, f)" 
> 
> Michael Bishop
> -----Original Message-----
> From: Andrew Plotkin [mailto:erkyrath@eblong.com] 
> Sent: Friday, June 02, 2006 12:20 PM
> To: batik-users@xmlgraphics.apache.org
> Subject: RE: Extracting information from a transformation matrix
> 
> On Fri, 2 Jun 2006, Bishop, Michael W. CONTR J9C880 wrote:
> 
> > I don't care how it looks at all.  I don't need to present information
> > to the user.  I can store the 6 values and keep it that way.
> 
> Ok.
> 
> > But realistically, if I wanted to rotate around a center point, I'd
> > translate to the center point, perform the rotation, then
> "untranslate"
> > to the center point.  Does Batik assist with these calculations?
> 
> The SVGMatrix interface has a multiply(SVGMatrix) method.
> 
> > Am I even on the right
> > track here in that every operation I want to do is a new
> multiplication?
> 
> Yes, that's right.
> 
> > After I rotate, if I want to translate again, do I have to "undo"
> > anything or just multiply in a new (tx, ty)?
> 
> Just multiply in a new one.
> 
> --Z
> 
> -- 
> "And Aholibamah bare Jeush, and Jaalam, and Korah: these were the
> borogoves..."
> *
> If the Bush administration hasn't subjected you to searches without a
> warrant,
> it's for one reason: they don't feel like it. Not because you're
> innocent.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message