Professional Documents
Culture Documents
Computer Graphics Past Papers Solution
Computer Graphics Past Papers Solution
01
Suppose a triangle with points A(4,1), B(6,1) C(4,3). Find the
composite transformation matrix to transform this triangle into
A'(1,4), B'(1,2) C'(5,4)
Solution
To find the composite transformation matrix that transforms the triangle with points A(4,1), B(6,1),
C(4,3) into A'(1,4), B'(1,2), C'(5,4), we can follow these steps:
1. Determine the individual transformations required to map each point to its
corresponding point.
2. Multiply the transformation matrices to obtain the composite transformation matrix.
Let's start by finding the transformation matrix for each point:
For point A: To transform point A(4,1) to A'(1,4), we need to perform the following transformations:
For point C: To transform point C(4,3) to C'(5,4), we need to perform the following transformations:
Now, let's compute the transformation matrices for each of these transformations:
Solution
To find the homogeneous matrix M that transforms the triangle with vertices, A(0,0), B(0,1)
C(1,0) into A'(1,1), B'(2,2) C'(3,1) respectively, you can use the following steps:
1. Find the transformation that maps each vertex of the original triangle to its
corresponding vertex in the new triangle
2. Construct the homogeneous matrix M based on these transformations.
Now, let's construct the homogeneous matrix M which represents the transformation that
maps points from one coordinate system to another. In this case, we're transforming points
from one triangle to another by translating them.
In our case, since we are only translating the points, the linear transformation part of the matrix
will be the identity matrix (since we are not scaling or rotating the points), and the translation
part will be the translation vector
The translation vector is simply the difference between the corresponding points in the two
triangles.
Since there is no scaling or rotation involved, the linear transformation part of the matrix will
be the identity matrix:
Now, if you multiply this matrix with the homogeneous coordinates of each point in the
original triangle, you will obtain the transformed points. For example, for point A the
transformation would be:
Solution
Solution: I
SOLUTION
To develop the midpoint algorithm for scan-converting a circle starting at pixel
location X=R, Y=0 in a clockwise direction, we first need to understand the general
idea behind the midpoint circle algorithm.
The midpoint circle algorithm is an efficient method for drawing circles in computer
graphics. It works by determining the positions of pixels along the circle's
circumference by analyzing the midpoint of regions between pixels. The algorithm
takes advantage of the circle's symmetry to avoid redundant calculations.
1. Initialization: Set the initial point of the circle (X=R, Y=0) and calculate the initial
decision parameter.
2. Iteration: Repeat until the decision parameter indicates that the entire circle has
been traversed.
1. Decision Parameter:
- For a circle centered at the origin, the decision parameter (P) at pixel (x, y) is given
by:
- At each step, the decision parameter helps determine the next pixel position.
- Based on the current decision parameter and the circle's symmetry, we have four
possible choices for the next pixel:
- At each step, update the decision parameter using the following rules:
By following these equations and rules, you can implement the midpoint circle
algorithm to scan-convert a circle starting at pixel location X=R, Y=0 in a clockwise
direction.
Question
Consider three different raster systems with resolutions of 640 by 480, 1280 by
1024, and 2560 by 2048.
(a) What size frame buffer (in bytes is needed for each of these systems to store
12 bits per pixel?
(b) How, much storage is required for each system if 24 bits per pixel are to be
stored?
Solution
To calculate the size of the frame buffer for each system, we need to consider the
resolution and the number of bits per pixel.
Total bits = Total pixels * bits per pixel = 307,200 * 12 = 3,686,400 bits
= 3,686,400 / 8
= 460,800 bytes
Total bits = Total pixels * bits per pixel = 1,310,720 * 12 = 15,728,640 bits
= 1,966,080 bytes
Total bits = Total pixels * bits per pixel = 5,242,880 * 12 = 62,914,560 bits
= 62,914,560 / 8
= 7,864,320 bytes
Total bits = Total pixels * bits per pixel = 307,200 * 24 = 7,372,800 bits
= 7,372,800 / 8
= 921,600 bytes
Total bits = Total pixels * bits per pixel = 1,310,720 * 24 = 31,457,280 bits
= 31,457,280 / 8
= 3,932,160 bytes
Total bits = Total pixels * bits per pixel = 5,242,880 * 24 = 125,829,120 bits
Size of frame buffer = Total bits / 8
= 125,829,120 / 8
= 15,728,640 bytes
These calculations give the size of the frame buffer needed for each system for storing
either 12 bits per pixel or 24 bits per pixel.
Question
Suppose a rectangular window whose lower left-hand corner is at L(-3,1) and
upper right-hand corner is at R(2,6). Use the Ling-Barsky algorithm to clip the
following lines. Line A: (1,2) to (-2,3) Line B: (-4,3) to (-1,7) Line C: (-1,5) to (3,8)
please also Calculate the values of r for entering and leaving intersections. Clip
the line if needed.
To apply the Liang-Barsky algorithm, we need to first define the region of the window and
then check for intersections of each line with the window boundaries. The algorithm will
determine whether the line lies completely inside the window, partially inside, or completely
outside. If partially inside, it will clip the line accordingly.
Given:
Window lower left corner: L(-3, 1)
Window upper right corner: R(2, 6)
Let's denote the boundaries of the window
Left boundary: x = -3
Right boundary: x = 2
Bottom boundary: y = 1
Top boundary: y = 6
We'll use the Liang-Barsky algorithm to clip each line. The algorithm works by calculating the
values of r for entering and leaving intersections. Here are the steps:
Calculate the direction vector of the line (dx, dy) and the differences between the line's starting
point and the window boundaries (p1, p2, p3, p4)
Initialize values of r for entering (r_enter) and leaving (r_leave) intersections
Check against the window boundaries to calculate r_enter and r_leave
Clip the line using the calculated values of r_enter and r_leave
Line A: (1,2) to (-2,3)
Direction vector (dx, dy) = (-2 - 1, 3 - 2) = (-3, 1)
Differences:
p1 = -3 - (-3) = 0
p2 = 2 - 1 = 1
p3 = 1 - (-3) = 4
p4 = 6 - 2 = 4