Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2009
    Posts
    9
    Rep Power
    0

    Default Rotating image based on the direction of a line

    Hello,
    My question really has more to do with math than Java; although, I'm trying to rotate a buffered image using rotate(double theta) from Graphics2D based on the direction of point A to point B.
    [Graphics2D (Java 2 Platform SE v1.4.2)

    Could someone provide the equation? Also, if there's a better way of doing this, please do tell.

    Thanks.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,529
    Blog Entries
    7
    Rep Power
    20

    Default

    You have to define the phrase "based on the direction of point A to point B" a bit better.

    kind regards,

    Jos

  3. #3
    Join Date
    Aug 2009
    Posts
    9
    Rep Power
    0

    Default

    Quote Originally Posted by JosAH View Post
    You have to define the phrase "based on the direction of point A to point B" a bit better.

    kind regards,

    Jos
    I created an image to illustrate what I want to do; hopefully it'll help. The box represents the image. I would like the south part of the box to be parallel with the line.

    http://img831.imageshack.us/img831/7606/examplehp.png

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,529
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by YellowPainting View Post
    I created an image to illustrate what I want to do; hopefully it'll help. The box represents the image. I would like the south part of the box to be parallel with the line.

    http://img831.imageshack.us/img831/7606/examplehp.png
    Understood; now you have to define the centre of your rotation. The angle of the rotation is defined by the slope of the line.

    kind regards,

    Jos

  5. #5
    Join Date
    Aug 2009
    Posts
    9
    Rep Power
    0

    Default

    Quote Originally Posted by JosAH View Post
    Understood; now you have to define the centre of your rotation. The angle of the rotation is defined by the slope of the line.

    kind regards,

    Jos
    Thanks, helped a lot.

Similar Threads

  1. Replies: 3
    Last Post: 06-16-2010, 10:27 PM
  2. Rotating an image
    By lackofcolor in forum Java 2D
    Replies: 3
    Last Post: 02-27-2009, 11:54 PM
  3. Rotating Image?
    By sciguy77 in forum Java Applets
    Replies: 9
    Last Post: 02-17-2009, 01:47 AM
  4. Rotating and flipping an image in SWT
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-02-2008, 08:01 PM
  5. non web based image verification integration
    By therock in forum AWT / Swing
    Replies: 1
    Last Post: 01-10-2008, 11:22 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
  •