[ x'] [ m00 m01 m02 ] [ x ] [ m00 * x + m01 * y + m02 ] [ y'] = [ m10 m11 m12 ] [ y ] = [ m10 * x + m11 * y + m12 ] [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]Though AffineTransform is often associated with drawing, it is not tied in any way to the Graphics class. It is purely mathematical.
|Manual Use||Learning More|
The basic idea is this. A transform maps every point x,y onto a new point, by a combination of rotation, scaling, translation and mirroring. You can manually transform a point like this:
You can also simply plug an AffineTransform into your Graphics2D object. Then you can specify simple coordinates and the drawing will appear in transformed coordinates. Note that with Graphics2D, your coordinates are doubles not ints.
The catch is, the mouse knows nothing about your transforms. You need to convert mouse screen coordinates to your user-coordinates. This is the inverse of what you normally do, namely converting convenient user coordinates to pixel display coordinates. For this, you need the inverse of your transform.
You can learn more with a Google search.
available on the web at:
optional Replicator mirror
Please email your feedback for publication, letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : . If you want your message, your name or email kept confidential, not considered for public posting, please explicitly specify that. Unless you state otherwise, I will treat your message as a letter to the editor that I may or may not publish in the feedback section. After that, it will be too late to retract it. If you disagree with something I said, especially when sending an ad-hominem attack, a rant composed mainly of obscenities or a death threat, please quote the offending passage and cite the web page where you found it, tell me why you think it is wrong, and, if possible, provide some supporting evidence. I can’t very well fix erroneous or ambiguous text if I can’t find it.
Your face IP:[126.96.36.199]
|Feedback||You are visitor number 47,184.|