|
-
Sep 29th, 2003, 11:30 AM
#1
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.
-
Sep 29th, 2003, 01:23 PM
#2
Fanatic Member
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?
-
Sep 29th, 2003, 04:04 PM
#3
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.
-
Sep 29th, 2003, 05:19 PM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|