1(a) Consider a 3D pyramid with a rectangular base lying in the XZ-plane and an apex
Q1:
(tip) above it. The vertices of the pyramid are given in 3D space as A(1,0,1), B(3,0,1),
C(3,0,4), D(1,0,4) and the apex at E(2,5,2.5). The pyramid undergoes a series of
transformations involving reflections (consider the right hand coordinate system): first
across the XZ-plane, followed by a reflection across the XY-plane, and then another
reflection across the XZ-plane. You are required to find the homogeneous
transformation matrix that represents the combined effect of these three reflections.
Using homogeneous coordinates, calculate the new coordinates of the vertices after the
reflections. Afterward, analyze whether it is possible to construct a translation matrix in
homogeneous coordinates that would align the reflected pyramid exactly with the
original pyramid. If such a matrix exists, provide the corresponding translation matrix. [4
marks]
Q2 (a): Give the algorithm for Weiler Atherton 2D Polygon Clipping. [3 marks]
1(b)
Q2 (b): Clip the polygon with vertices (numbered 1 to 4 from left to right): (80, 120),
1(c)
(220, 80), (280, 200), and (90, 260), against the rectangular clipping window with
vertices (100, 100), (250, 100), (250, 250), and (100, 250), using the
Sutherland–Hodgman algorithm. (Consider boundary points inside the window.) Begin
with vertex 1 and proceed towards vertex 2 and so on. [3 marks]
Q2
1 (b)
OR
For a counterclockwise traversal of the polygon fill-area vertices, we apply the following
Weiler-Atherton procedures:
1. Process the edges of the polygon fill area in a counterclockwise order until an
inside-outside pair of vertices is encountered for one of the clipping boundaries; that is,
the first vertex of the polygon edge is inside the clip region and the second vertex is
outside the clip region.
2. Follow the window boundaries in a counterclockwise direction from the
exit-intersection point to another intersection point with the polygon. If this is a
previously processed point, proceed to the next step. If this is a new intersection point,
continue processing polygon edges in a counter- clockwise order until a previously
processed vertex is encountered.
3. Form the vertex list for this section of the clipped fill area.
4. Return to the exit-intersection point and continue processing the polygon edges in a
counterclockwise order. With Example
Marking: If algo given in para form (2.5 marks out of 3)
If only example given (1.5 marks out of 3)
If mixed with sutherland algorithm ([0.5-1] marks out of 3)
Answer 1 (a)
0.5 each for 3 reflection matrices (1.5)
0.5 for composite matrix
1 mark for correct updated coordinates if in homogeneous coordinates format
if not in format but coordinates correct 0.5 marks given
1 mark for translation
1(c)
If any order followed still full marks given
If intersection points given but not used the algorithm, 0 marks
If solved using wiler algorithm, 0 marks,
1,2 small mistakes, ignored
2(a) Key differences between B-Spline curve and Bezier curve
0.5 marks for each points. Total marks 02
Aspect B-Spline Curve Bezier Curve
Local Control Yes No
Flexibility More flexible Less Flexible
Degree Independent Tied to number of control
points
Passes Through Usually doesn’t pass through Only end points
any point
2(b)
Equation of planes 0.5 marks each
Plane ACD
2x – y + z = 0
ZACD = -2x + y
Plane CBD
-2x – y + z + 8 = 0
ZCBD = 2x + y – 8
Plane BAD
0x – 2y – 2z – 0 = 0
ZBAD = -y
Plane ACB
y=1
X Y Z Z(max) Color
ACD -1 ACD/BAD
1 CBD -5 -1
BAD -1
1
ACD 0 Background
2 CBD -4 0
BAD -2
ACD -3 BAD
1 CBD -3 -1
BAD -1
2
ACD -2 ACD/CBD/BAD
2 CBD -2 -2
BAD -2
ACD -5 CBD/BAD
1 CBD -1 -1
BAD -1
3
ACD -4 Background
2 CBD 0 0
BAD -2
0 0 0 0 0
1 0 1/3 3 2/3
2 0 0 1/2/3 0
3 0 0 0 0
0 1 2 3
Q3a. To solve this using the Depth Sorting Method (Painter’s Algorithm), we'll go through
the five key tests and use them to order the triangles correctly for drawing.
2.5 Marks for Algorithm
Painter's Algorithm:
The Painter's algorithm works by sorting surfaces in back-to-front order and then rendering
them in that order. The five key tests are:
1. Z-depth comparison: Does one triangle lie completely behind another in Z-depth?
2. X and Y extents test: Do the projections of the triangles overlap in X and Y?
3. Bounding box test: Do the bounding boxes intersect?
4. Surface overlap test: Do the surfaces intersect or overlap when projected?
5. Cyclic overlap or need for splitting: If there’s cyclic overlap, surface splitting may
be necessary.
Analysis of the Given Triangles:
From the diagram, the approximate Z-order (depth from furthest to nearest) based on
overlapping and occlusion is:
• Triangle 1 is partially behind Triangle 4
• Triangle 2 is behind Triangle 1
• Triangle 3 is in front of Triangle 4 and covers part of 1
• Triangle 5 is not occluded by any triangle, so it is the furthest or separate
Step-by-Step Table for Painter’s Algorithm
Triangles
Step Test Performed Result/Observation Action Taken
Compared
Z-depth, X-Y
1 2 vs 1 2 is behind 1 Draw 2 before 1
overlap
Z-depth, X-Y
2 1 vs 4 1 is behind 4 Draw 1 before 4
overlap
Z-depth, X-Y
3 4 vs 3 4 is behind 3 Draw 4 before 3
overlap
Bounding box & Can be drawn at
4 5 vs others 5 does not overlap with any
overlap check any point
Final composite 2 → 1 → 4 → 3 (with 5 Final drawing order
5 Order of all
order placed anywhere) determined
Final Correct Drawing Order:
2→1→4→3→5
(or you can draw 5 first or last, since it doesn't intersect with others)
This order ensures that each triangle is drawn after all surfaces behind it, achieving proper
hidden surface removal.
2.5 Marks for solution
Q 3b To check parametric and geometric continuity between two curves, we analyze their
derivatives and how well they match up at the point where they are joined. Let's go step by step.
1 mark for theory
Given Curves:
1. P(t)=(t,t2),t∈[0,1]P(t) = (t, t^2), \quad t \in [0,1]
2. Q(t)=(1+t,1+2t+t2),t∈[0,1]Q(t) = (1 + t, 1 + 2t + t^2), \quad t \in [0,1]
We need to examine continuity at the connecting point:
• End of P(t)P(t) at t=1t = 1
• Start of Q(t)Q(t) at t=0t = 0
2 Marks for Solution
1. Parametric Continuity (Cⁿ continuity)
▶ C⁰ Continuity (Positional continuity):
We check if the two curves join at the same point.
• P(1)=(1,12)=(1,1)P(1) = (1, 1^2) = (1, 1)
• Q(0)=(1+0,1+2(0)+02)=(1,1)Q(0) = (1 + 0, 1 + 2(0) + 0^2) = (1, 1)
C⁰ is satisfied
▶ C¹ Continuity (First derivative continuity):
We check if the first derivatives are equal at the junction.
• P′(t)=(1,2t)⇒P′(1)=(1,2)P'(t) = (1, 2t) \Rightarrow P'(1) = (1, 2)
• Q′(t)=(1,2+2t)⇒Q′(0)=(1,2)Q'(t) = (1, 2 + 2t) \Rightarrow Q'(0) = (1, 2)
C¹ is satisfied
▶ C² Continuity (Second derivative continuity):
• P′′(t)=(0,2)⇒P′′(1)=(0,2)P''(t) = (0, 2) \Rightarrow P''(1) = (0, 2)
• Q′′(t)=(0,2)⇒Q′′(0)=(0,2)Q''(t) = (0, 2) \Rightarrow Q''(0) = (0, 2)
C² is satisfied
Since both curves are polynomials of degree 2, no derivatives beyond second exist, so:
Cⁿ continuity is satisfied for all n ≤ 2
2 Marks for Solution
2. Geometric Continuity (Gⁿ continuity)
Geometric continuity is less strict than parametric continuity. Instead of exact derivative matching, it
requires directional (and possibly curvature) consistency.
▶ G⁰ Continuity:
Same as C⁰ – the curves connect at the same point.
G⁰ is satisfied
▶ G¹ Continuity:
Tangents at the join point must have the same direction, but not necessarily the same magnitude.
• P′(1)=(1,2)P'(1) = (1, 2)
• Q′(0)=(1,2)Q'(0) = (1, 2)
Direction vector for both is the same ⇒ ratio of components = 1
G¹ is satisfied
▶ G² Continuity:
Requires consistent curvature direction and rate of turning (proportional second derivatives,
adjusted for reparameterization).
Let’s compute normalized derivatives and curvature (for deeper checks), or just see if the second
derivatives are scalar multiples.
• P′(1)=(1,2)P'(1) = (1,2), P′′(1)=(0,2)P''(1) = (0,2)
• Q′(0)=(1,2)Q'(0) = (1,2), Q′′(0)=(0,2)Q''(0) = (0,2)
Because both first and second derivatives match exactly, the curvature and its change are preserved.
G² is satisfied
Final Conclusion:
Continuity Type Satisfied?
C⁰ Yes
C¹ Yes
C² Yes
G⁰ Yes
G¹ Yes
G² Yes
All orders of parametric and geometric continuity (up to order 2) are satisfied at the junction
point (1,1)(1, 1) between P(t)P(t) and Q(t)Q(t).
Q4 a)
Step 1: Region Codes for Each Point (Using Slide Rules)
➤ Point A: (−2,0.5,0.5,1)
• h+x=1−2=−1 → Bit 1 = 1 (Left)
• h−x=1+2=3 → Bit 2 = 0
• h+y=1+0.5=1.5 → Bit 3 = 0
• h−y=1−0.5=0.5 → Bit 4 = 0
• h+z=1+0.5=1.5 → Bit 5 = 0
• h−z=1−0.5=0.5 → Bit 6 = 0
→ Region Code A: 000001
➤ Point B: (0.5,2,−3,1)
• h+x=1+0.5=1.5 → Bit 1 = 0
• h−x=1−0.5=0.5 → Bit 2 = 0
• h+y=1+2=3→ Bit 3 = 0
• h−y=1−2=−1→ Bit 4 = 1 (Top)
• h+z=1−3=−2→ Bit 5 = 1 (Near)
• h−z=1+3=4 → Bit 6 = 0
→ Region Code B: 011000
➤ Point C: (0,0,0,1)
• h+x=1+0=1 → Bit 1 = 0
• h−x=1−0=1 → Bit 2 = 0
• h+y=1+0=1 → Bit 3 = 0
• h−y=1−0=1 → Bit 4 = 0
• h+z=1+0=1 → Bit 5 = 0
• h−z=1−0=1 → Bit 6 = 0
→ Region Code C: 000000
➤ Point D: (0.5,0.5,0.5,1)
• All values are within the bounds −1≤x,y,z≤1, so all tests pass → All bits = 0
→ Region Code D: 000000
Step 2: Clipping Decisions
➤ Line AB:
• Region Code A: 000001
• Region Code B: 011000
• Logical AND: 000001 & 011000 = 000000 → Not trivially rejected
• Logical OR: 000001 | 011000 = 011001 → Not all zero → Not trivially accepted
→ Line AB: Partially inside – Needs clipping
➤ Line CD:
• Region Code C: 000000
• Region Code D: 000000
• Logical AND: 000000 & 000000 = 000000
• Logical OR: 000000 | 000000 = 000000
→ Line CD: Completely inside – Visible
Final Summary:
Line Region Codes (A-B / C-D) Result
AB A: 000001, B: 011000 Needs clipping
CD C: 000000, D: 000000 Completely visible
Q4 b)
Step 1: Parametrize the Line Passing Through C and P
We are given:
• Center of projection: C=(0,2,4)
• Point to project: P=(6,5,7)
• The parametric equation of the line L(t) passing through C and P is:
L(t) = C + t(P - C)
Substituting the coordinates:
L(t) = (0, 2, 4) + t[(6, 5, 7) - (0, 2, 4)] = (0, 2, 4) + t(6, 3, 3)
Therefore, the parametric coordinates are:
x = 6t, y = 2 + 3t, z = 4 + 3t
Step 2: Substitute into the Plane Equation
The plane equation is:
2x - y + 3z = 5
Substitute the parametric expressions:
2(6t) - (2 + 3t) + 3(4 + 3t) = 5
Simplify:
12t−2−3t+12+9t=5
(12t−3t+9t)+(−2+12)=5
18t + 10 = 5
18t = -5
t = -5/18
Step 3: Find the Coordinates of the Projection
Substitute t = -5/18 back into the parametric equations:
x= 6t = -5/3
y= 2 + 3t = 7/6
z= 4 + 3t = 19/6
Final Answer:
The perspective projection of the point (6,5,7) onto the plane 2x−y+3z=5, from the center of
projection (0,2,4) is:
[-5/3, 7/6, 19/6]
Each part of 2 marks, total=6
Each Part 2 marks, within each part, 1 mark for each intersection point
Marks 0.5x2=1
1 Mark
Q5. Given:
• 8-bit indexed color mode (256 entries max).
• Each index maps to a 24-bit RGB color in the Color Lookup Table (CLUT).
Answer 5a
1 Mark for result
CLUT Entries:
Index RGB Value
0 (255, 255, 255)
1 (0, 0, 0)
2 (255, 0, 0)
3 (0, 255, 0)
4 (0, 0, 255)
5 (255, 255, 0)
Indexed Image Data (4×4):
[ [0, 1, 2, 3],
[4, 5, 0, 1],
[2, 3, 4, 5],
[1, 0, 1, 2] ]
Step 1: Convert Indexed Image to RGB
We’ll convert each index to its corresponding RGB triplet using the CLUT:
Row 0:
• 0 → (255, 255, 255)
• 1 → (0, 0, 0)
• 2 → (255, 0, 0)
• 3 → (0, 255, 0)
Row 0 (RGB):
[ (255,255,255), (0,0,0), (255,0,0), (0,255,0) ]
Row 1:
• 4 → (0, 0, 255)
• 5 → (255, 255, 0)
• 0 → (255, 255, 255)
• 1 → (0, 0, 0)
Row 1 (RGB):
[ (0,0,255), (255,255,0), (255,255,255), (0,0,0) ]
Row 2:
• 2 → (255, 0, 0)
• 3 → (0, 255, 0)
• 4 → (0, 0, 255)
• 5 → (255, 255, 0)
Row 2 (RGB):
[ (255,0,0), (0,255,0), (0,0,255), (255,255,0) ]
Row 3:
• 1 → (0, 0, 0)
• 0 → (255, 255, 255)
• 1 → (0, 0, 0)
• 2 → (255, 0, 0)
Row 3 (RGB):
[ (0,0,0), (255,255,255), (0,0,0), (255,0,0) ]
Answer 5b
1 Mark for result
Step 2: Find RGB Value at (2,3)
• Remember: indexing starts from 0.
• (2,3) = 3rd row, 4th column
• From Row 2, 4th value is index 5
• CLUT[5] = (255, 255, 0)
Final Answer:
• The RGB value at position (2,3) is (255, 255, 0)