Hi Michael, Andrew,
Andrew Plotkin <erkyrath@eblong.com> wrote on 06/01/2006 11:47:12 PM:
> On Thu, 1 Jun 2006, Bishop, Michael W. CONTR J9C880 wrote:
>
> > Ouch. Major headache.
> >
> > Assume that the transformation is always in order:
> >
> > translate(x,y) scale(sx, sy) rotate(t, cx, cy)
> >
> > As stated, we're given cx, and cy:
> >
> > transform="translate(20, 20) scale(3,3) rotate(60, 2, 2)"
> >
> > At this point I've dragged the element some unknown amount. Although
> > translate says (20, 20), I know this is not correct because I've also
> > scaled and rotated.
>
> Honestly, the easiest thing to do is store it as a matrix. Multiply your
> translate(20,20) matrix on the right (or is it the left?) and you'll get
> the correct answer. Don't convert it to "translate(x,y) scale(sx, sy)
> rotate(t, cx, cy)" until you need to.
Right, the best way to view the matrix is as a matrix. If you want
to have it 'make sense' to the user you may choose to decompose it
but even that shouldn't really try and make sense of the matrix as a
whole. The basic trick here is to try and do the following
M = original matrix;
R = Rotation about Center Point
R' = inverse of R
M = M*R'*R, M1 = M*R', M = M1*R
S = Scale (around Center point, if you want)
S' = inverse of S
M = M1*S'*S*R, M2 = M1*S', M = M2*S*R
At this point M2 should be of the form:
1 0 Tx
0 1 Ty
(actually my guess is that you won't have quite 1 0, 0 1
but it should be close enough).

To unsubscribe, email: batikusersunsubscribe@xmlgraphics.apache.org
For additional commands, email: batikusershelp@xmlgraphics.apache.org
