You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by BigLiu <bi...@gmail.com> on 2007/08/02 23:19:03 UTC

convert matrix to rotation

In original SVG file exported from Illustrator we have: 
 
<rect width="222.92" height="167.19" x="22.54" y="33.61"
transform="matrix(0.9509 -0.3095 0.3095 0.9509 -29.6934 47.2265)" />

 I have some java code that will reverse engineer this to

<rect width="222.92" height="167.19" x="22.54" y="33.61"
transform="translate(-29.6934 47.2265) rotate(-18)">

But actually I really need is to make it even simpler: 

<rect width="222.92" height="167.19" x="newX" y="newY"
transform="rotate(-18)">

newX could be: 22.54 + translateX*somefactor   or some formula based on
original matrix value
newY could be: 33.61 + translateY*somefactor  or some formula based on
original matrix value

I want to get rid of translate(translateX, translateY) in the transform tag.
We have some tool only know how to do rotation based on x, y and rotation. 

I can not figure out the formula. Can anyone please help? 

Really appreciate. 




 

 

And now we need reverse engineer (from original matrix or from above) 
actually to: 

 

X=”newXoff”   y=”newYoff”  transform="rotate(-18)"

 

 


-- 
View this message in context: http://www.nabble.com/convert-matrix-to-rotation-tf4208838.html#a11972996
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: convert matrix to rotation

Posted by th...@kodak.com.
Hi BigLiu,

BigLiu <bi...@gmail.com> wrote on 08/02/2007 05:19:03 PM:

> In original SVG file exported from Illustrator we have: 
> 
> <rect width="222.92" height="167.19" x="22.54" y="33.61"
> transform="matrix(0.9509 -0.3095 0.3095 0.9509 -29.6934 47.2265)" />
> 
>  I have some java code that will reverse engineer this to
> 
> <rect width="222.92" height="167.19" x="22.54" y="33.61"
> transform="translate(-29.6934 47.2265) rotate(-18)">
> 
> But actually I really need is to make it even simpler: 
> 
> <rect width="222.92" height="167.19" x="newX" y="newY"
> transform="rotate(-18)">

   To do this you need to map your translate through the rotate
transform.  I think this can be done by mapping the X,Y (translate) 
pair through the inverse of the rotation matrix.

> newX could be: 22.54 + translateX*somefactor   or some formula based on
> original matrix value
> newY could be: 33.61 + translateY*somefactor  or some formula based on
> original matrix value
> 
> I want to get rid of translate(translateX, translateY) in the transform 
tag.
> We have some tool only know how to do rotation based on x, y and 
rotation. 
> 
> I can not figure out the formula. Can anyone please help? 
> 
> Really appreciate. 


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