Hi Ted
You may try the following (note: it just write what popup from my head. I
didn't check to make sure I didn't made any error).
> If only working with translation, scaling, and rotation (no shear),
> is there a way to decompose the AffineTransform into translation,
> scale and rotation?
What about the following?
translateX = tr.getTranslateX();
translateY = tr.getTranslateY();
scaleX0 = Math.sqrt(tr.getScaleX()*tr.getScaleX() +
tr.getShearX()*tr.getShearX());
scaleY0 = Math.sqrt(tr.getScaleY()*tr.getScaleY() +
tr.getShearY()*tr.getShearY());
rotate = Math.acos(tr.getScaleX()/scaleX);
(The above only give rotation between 0 and 180�)
You can check (with a little bit of arithmetic) that scaleX0 and scaleY0 (as
computed above) are invariant under rotation and translation. A convenience
method for scaleX0 and scaleY0 is the subject of RFE #4253892.
> What I would like to do is to give the user the ability to restore the
> default/initial state of the image for any of the three operations
> independently.
>
> For example, suppose the user first scales the image, then rotates
> the image and lastly, translates the image.
>
> At this point, how do I let the user maintain the current scale and
> translation, but reset the rotation to its original setting?
The following should work:
tr.setTransform(scaleX0, 0, 0, scaleY0, translateX, translateY);
Martin.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".