Results 1 to 5 of 5
Thread: Rotation & translation combined
- 02-28-2009, 12:09 AM #1
Member
- Join Date
- Jan 2009
- Posts
- 35
- Rep Power
- 0
Rotation & translation combined
Hello-
I'm writing a program in which the user can use the mouse to rotate a shape, and then use the mouse to translate the shape. Or the user can do it in reverse order (translate and then rotate).
The program works fine when the user only performs one of the operations, but the results are not right when the user perform both operations.
I think this may have to do with the idea that when you perform a rotation, you have changed the coordinate system, so the translation now has a different effect.
On the other hand, I would like to discuss the AffineTransform.rotate(theta, anchorx, anchory) method. The docs say that this is equivalent to a sequence of calls where you translate, rotate and then translate back. I have used the method and it works fine. However, when you translate back, don't you end up in a different spot, because the rotation changed your coordinate system?
This question seems to be related to my original idea, that rotation changes the coordinate system, so that translation works differently. Or does it?
If anyone has done work in this area, I'd appreciate your insights.
-Scott
- 02-28-2009, 08:10 PM #2
Yes, rotation rotates the coordinate system.
db
- 03-08-2009, 01:16 PM #3
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
You can transform the mouse coordinates as well, to keep everything in the same coordinate system.
- 02-27-2011, 04:39 PM #4
Member
- Join Date
- Feb 2011
- Posts
- 5
- Rep Power
- 0
i had a similar problem and i figured it out, and believe it or not it was by reading this post that the answer came to me :P, i think ur prob though is a bit more complex then mine. Mine was a bit simple but id be glad to help if ur still having trouble, send me a msg if u need assistance.
- 02-27-2011, 06:57 PM #5
1. Please take the trouble to use proper words. Recommended reading: How To Ask Questions The Smart Way
2. The question was asked a year and a half ago. Please don't resurrect zombies.
3. Problems and possible solutions are posted on the forum for all to share. There is no call for anyone to send you a 'msg'
db
Similar Threads
-
X / Y Translation Problem
By SkinnyK in forum New To JavaReplies: 4Last Post: 01-16-2009, 12:20 AM -
Log rotation in ubuntu
By sarah11 in forum New To JavaReplies: 0Last Post: 11-04-2008, 07:46 AM -
Transform Translation and Rotation
By Java Tip in forum java.awtReplies: 0Last Post: 06-22-2008, 10:58 PM -
Transform Rotation Translation
By Java Tip in forum java.awtReplies: 0Last Post: 06-21-2008, 08:53 PM -
Rotation in java 3D
By émilie- in forum Java AppletsReplies: 0Last Post: 02-13-2008, 10:37 AM


LinkBack URL
About LinkBacks


Bookmarks