Results 1 to 5 of 5
  1. #1
    ScottVal is offline Member
    Join Date
    Jan 2009
    Posts
    35
    Rep Power
    0

    Default 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

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default

    Yes, rotation rotates the coordinate system.

    db

  3. #3
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    You can transform the mouse coordinates as well, to keep everything in the same coordinate system.

  4. #4
    brigadier90 is offline Member
    Join Date
    Feb 2011
    Posts
    5
    Rep Power
    0

    Default

    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.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default

    Quote Originally Posted by brigadier90 View Post
    if ur still having trouble, send me a msg if u need assistance.
    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

  1. X / Y Translation Problem
    By SkinnyK in forum New To Java
    Replies: 4
    Last Post: 01-16-2009, 12:20 AM
  2. Log rotation in ubuntu
    By sarah11 in forum New To Java
    Replies: 0
    Last Post: 11-04-2008, 07:46 AM
  3. Transform Translation and Rotation
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-22-2008, 10:58 PM
  4. Transform Rotation Translation
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-21-2008, 08:53 PM
  5. Rotation in java 3D
    By émilie- in forum Java Applets
    Replies: 0
    Last Post: 02-13-2008, 10:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •