Results 1 to 4 of 4

Thread: Calculate the size of rotating picture

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Calculate the size of rotating picture

    I have a picture that is 100 pixels wide by 200 pixels high. This picture is going into a picture box and will then be rotated at various angles. What I need to be able to figure out is how big the picture box has to be as the picture rotates so I don’t chop any of it off.

  2. #2
    Fanatic Member JPicasso's Avatar
    Join Date
    Aug 2001
    Location
    Kalamazoo, MI
    Posts
    843
    assuming you're rotating about the center, wouldn't this be a classic application of pythagreans' therum?

    (100^2 + 200^2)^.5 =223.60679774997896964091736687313

    so, each side would need to accomodate 224 pixels. right?
    Merry Christmas

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    What I'm really looking for is to keep the container only large enough to house the image. While the image may be able to fit within a square that is in the range of 225 square, that is a much larger area than I need when the image is either vertical or rotated 90 degrees.

  4. #4
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    Try this:
    x = cos(rotation_angle)*height + sin(rotation_angle)*width
    y = sin(rotation_angle)*height + cos(rotation_angle)*width

    This should work. If it doesn't, let me know.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

Posting Permissions

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



Click Here to Expand Forum to Full Width