0% found this document useful (0 votes)
30 views6 pages

Solution

Uploaded by

Shiny Chakma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views6 pages

Solution

Uploaded by

Shiny Chakma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Part A: Multiple Choice Questions (10 × 1 =

10 Marks)
1. The graphics pipeline consists of the following stages:

• Answer: (a) Modeling, Transformation, Clipping, Rasterization

2. What is the primary advantage of Bresenham’s line-drawing algorithm


over DDA?

• Answer: (a) It uses only integer arithmetic

3. What is the main difference between scan-line and flood-fill algorithms?

• Answer: (a) Scan-line works line by line, flood-fill fills connected


pixels

4. A Bezier curve is defined by:

• Answer: (c) Control and anchor points

5. In spline curves, continuity is defined as:

• Answer: (d) All of the above

6. In window-to-viewport mapping, the transformation ensures:

• Answer: (b) A proper aspect ratio of the image

7. The Cohen-Sutherland algorithm identifies regions using:

• Answer: (a) Outcodes

8. In perspective projection, objects further away appear:

• Answer: (b) Smaller

9. The viewing transformation involves:

• Answer: (d) All of the above

10. Which of the following is true about perspective projection?

• Answer: (a) Parallel lines converge

1
Part B: Short Answer Questions (5 × 3 = 15
Marks)
1. Explain the region-filling algorithm using seed-fill or flood-fill
methods.

• Seed-Fill Algorithm: Starts at a ”seed point” inside the region


and spreads outward to fill all connected pixels until it hits the
boundary.
Recursive Approach: Recursively checks and fills neighboring
pixels.
Iterative Approach: Uses a stack to avoid recursion.
• Flood-Fill Algorithm: Fills all connected pixels with the same
color, commonly used in paint programs.
• Comparison: Seed-fill works well for defined boundaries. Flood-
fill is efficient for contiguous color regions but can overflow memory
in recursive methods.

2. What are modeling transformations? Explain their role in the


HCS (Homogeneous Coordinate System).

• Modeling transformations position, orient, and scale 3D ob-


jects in the scene.
• Translation: Moves the object to a new position.
• Scaling: Changes the object’s size.
• Rotation: Rotates the object about an axis.
• Role in HCS: Using HCS, coordinates are represented as [x, y, z, 1]
and transformations are performed using matrix multiplication.
HCS simplifies combining transformations into a single composite
matrix.

3. Write the steps involved in the Cohen-Sutherland line clipping


algorithm.

• Compute Outcodes: Calculate the region codes for each end-


point based on the window boundaries.
• Trivial Accept/Reject:

2
– If both endpoints have outcodes 0000 (logical AND), the line
is completely inside.
– If the logical AND of outcodes 0, the line is completely out-
side.
• Partial Clipping: If neither trivial accept nor reject applies, cal-
culate intersections with window boundaries using edge equations.
• Update endpoints and recompute outcodes.
• Repeat until the line segment lies fully inside or is rejected.

4. What are the advantages of using curved surface representa-


tion in 3D modeling?

• Smoothness: Curved surfaces ensure smooth transitions and re-


alistic rendering.
• Compact Representation: Fewer control points represent the
surface, reducing memory usage.
• Flexibility: Ideal for organic shapes such as human faces and
vehicles.
• Continuity: Provides various levels of continuity (e.g., positional,
tangential).

5. Explain the viewing pipeline.

• Modeling Transformation: Converts object coordinates into


world coordinates. Places and orients objects in the scene using
translation, rotation, and scaling.
• Viewing Transformation: Converts world coordinates to cam-
era (view) coordinates. Positions the camera at the origin and
reorients the scene using a ”look-at” matrix.
• Projection Transformation: Maps 3D view coordinates to 2D
projection coordinates.
– Types:
∗ Perspective projection: Simulates depth by making dis-
tant objects appear smaller.
∗ Orthographic projection: Maintains the same size regard-
less of distance.

3
• Clipping: Removes objects or parts outside the viewing volume
(e.g., frustum or cuboid).
• Window-to-Viewport Mapping: Maps the 2D projection win-
dow to the display screen (viewport) while maintaining the aspect
ratio.

Part C: Long Answer Questions (3 × 5 = 15


Marks)
1. Midpoint Circle Algorithm (Numerical)
Given r = 6, (h, k) = (0, 0):

Initialpoint :(x0 , y0 ) = (0, r) = (0, 6)

Initialdecisionparameter :p0 = 1 − r = −5
For each octant, calculate:

If pk < 0 : pk+1 = pk + 2xk + 3

Else :pk+1 = pk + 2xk − 2yk + 5


Steps to Plot Points Using Symmetry:
A circle is symmetric in all quadrants. If you calculate one point (x, y)
in the first octant (x ≤ y), you can use symmetry to find the corresponding
points in the other seven octants:

(x, y), (y, x), (−x, y), (−y, x), (−x, −y), (−y, −x), (x, −y), (y, −x)

Initial Setup:
Start at (x, y) = (0, r), where r is the radius of the circle. The initial
decision parameter is:
p0 = 1 − r
Iteration for the First Octant:
Calculate points in the first octant using the following rules:

If pk < 0 : T henextpointis(x + 1, y), pk+1 = pk + 2xk + 3

4
If pk ≥ 0 : T henextpointis(x + 1, y − 1), pk+1 = pk + 2xk − 2yk + 5
Example: Plot Points for a Circle of Radius r = 6:

Step − by − StepCalculation :

InitialP oint :(x0 , y0 ) = (0, 6)


InitialDecisionP arameter :p0 = 1 − 6 = −5

Iteration pk (x, y)
0 −5 (0, 6)
1 −2 (1, 6)
2 3 (2, 6)
3 0 (3, 5)
4 7 (4, 5)
5 6 (5, 4)

Final Plot: After calculating points in the first octant, we plot the points
for all octants using symmetry.

2. Cohen-Sutherland Line Clipping Algorithm (Numer-


ical)
Given endpoints (5, 8) and (15, 20), and window boundaries xmin = 4, xmax =
12, ymin = 6, ymax = 18:
Compute Outcodes:

P1 (5, 8) : outcode = 0000

P2 (15, 20) : outcode = 1010


Clip with window boundaries:
Clip P2 at xmax = 12, compute intersection:
20 − 8
y = y1 + m(xmax − x1 ), m= = 1.2
15 − 5
N ewP2 = (12, 14.4)
Final clipped line: (5, 8) to (12, 14.4).

5
3. Window-to-Viewport Transformation
Given window (2, 2) to (10, 8), and viewport (1, 1) to (5, 5):
Mapping Formula:
x − xw y − yw
x ′ = xv · + xmin
v , y ′ = yv · + yvmin
xmax
w − xwmin ywmax
− ywmin

Apply for point (4, 6):


4−2 6−2
x′ = 1 + (5 − 1) · = 2, y ′ = 1 + (5 − 1) · = 3.67
10 − 2 8−2
Mapped point: (2, 3.67).

You might also like