![]() | ||||
Online Judge | Problem Set | Authors | Online Contests | User |
---|---|---|---|---|
Web Board Home Page F.A.Qs Announcement | Current Contest Past Contests Scheduled Contests Award Contest |
Image Rotation
Description These
days, Hunk is developing a special software for 2D digital image
rotation. Here, the input image is described in the coordinate system
shown in Figure 1 where the leftmost pixel of the image lies on the y-axis and the bottommost pixel of the image lies on the x-axis.
The output image is described in the coordinate system shown in Figure
2 where and the leftmost pixel of the image lies on the y-axis, the topmost pixel lies on the x-axis. He considers the following: In
most cases, the dimensions of an image will change after rotation. As
shown in Figure 3, rotating the original image (the blue rectangle)
around its center will produce a new image (the red rectangle) with
different height and width. The task is, for an image of h ¡Á w pixels and an angle ¦Á
of counterclockwise rotation, to determine the dimensions in pixels of
the rotated image, and for each pixel in the new image described in the
coordinate system shown in Figure 2, to find its relative position in
the original image described in the coordinate system shown in Figure 1. Input The input consists of multiple test cases. Each test case consists of one line containing two positive integers h (1 ¡Ü h ¡Ü 128) and w (1 ¡Ü w ¡Ü 128) and a real number ¦Á (0 ¡Ü ¦Á ¡Ü 360) where h denotes the height of the image in pixels, w denotes the width of the image in pixels, ¦Á denotes the angle in degrees by which the image is rotated in counterclockwise direction. Process to the end of input. Output For each test case, first output one line containing two integer H and W separated by one space meaning the new image has H ¡Á W pixels. Then output H lines each containing W
coordinates representing the relative positions of pixels of the new
image in the original image. If a position falls on the original image,
output it in the format (y, x) with two decimal digits
beyond the decimal point, otherwise output (−1.00, −1.00) instead. The
coordinates are in the order in which pixels are aligned in the
coordinate system shown in Figure 2. Output a blank line after each
test case. Sample Input Sample Output Hint If the rotated image has dimensions lh ¡Á lw, then its dimensions in pixels are (floor(lh) + 1) ¡Á (floor(lw) + 1). Make sure that your solution won¡¯t output anything like ¡°−0.00¡±. Source |
[Submit] [Go Back] [Status] [Discuss]
All Copyright Reserved 2003-2005 Ying Fuchen,Xu Pengcheng
Any problem, Please Contact Administrator