I am using default rotate interactor to rotate picture displayed in the JSVGCanvas derived class. I was wondering, what is the best way to figure angle of rotation that is relative to the original (reset) transform. Sublclassing <code>AbstractInteractor</code> is my only option now. Is there a simpler way get that angle?
Hi Ilya,
The current rendering transform (which is what is adjusted by the interactors) is always available from JSVGCanvas.getRenderingTransform().
This is a 3x2 affine matrix. If you are willing to only consider uniform scaling and rotation (no non-uniform scale/shear - see squiggle's setTransform option) the angle of rotation is fairly easy to obtain from this matrix - if you aren't willing to restrict yourself to this case then in some cases rotation will not have any real meaning.
You want to take m00 (scale X) and m10 (shear X) and take the inverse tangent of that (Math.atan(m00, m10)). If you know a bit about matrix math you can see how this works by reading the documentation on java.awt.geom.AffineTransform().
You may also be interested to note that the determinate of the matrix is the uniform scaling effect of the matrix squared.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]