Skip to content
Unit 4 Syllabus Note· Computer Graphics and Animation

Computer Graphics and Animation

Comprehensive exam revision notes for BCA-305N Unit 4 (Curves, Surfaces & Spline Representations). Includes Section A (2M), Section B (5M), and Section C (15M) questions, answers, and diagrams.

Computer Graphics and Animation

Curves, Surfaces & Spline Representations

Core Definitions & Key Concepts

What is a Spline Curve

A Spline is a flexible curve defined mathematically by a piecewise polynomial function of degree n whose pieces connect smoothly with specified parametric continuity (C^0, C^1, C^2) at joint points called knots.

Parametric Continuity (C^k) and Geometric Continuity (G^k)

  • $C^0$: Curves simply touch at joint (P_1(1) = P_2(0)).
  • $C^1$: First derivatives (tangent vectors) are equal in both magnitude and direction.
  • $C^2$: Second derivatives (curvature) are equal.
  • $G^1$: Tangents point in the same direction, but magnitudes may differ.

State the mathematical formula for a Bezier Curve

A Bezier curve of degree n defined by n+1 control points P_i is given by: $P(u) = \sum_{i=0}^n B_{i, n}(u) P_i \quad (0 ≤ u ≤ 1) Where B_{i, n}(u) = \binom{n}{i} u^i (1 - u)^{n-i}$ are Bernstein Polynomials.

List three key mathematical properties of Bezier Curves

  1. Convex Hull Property: The curve lies entirely within the convex hull of its control points.
  2. Affine Invariance: Transforming the control points transforms the curve identically.
  3. Endpoint Interpolation: Always passes through first (P_0) and last (P_n) control points.

What is the primary drawback of Bezier Curves and how do B-Splines solve it

Bezier curves lack local control: moving a single control point alters the entire curve globally, and degree is tied to the number of points (n = points - 1). B-Splines decouple degree from point count and offer local control via knot vectors.

What is Visible Surface Determination (Hidden Surface Removal)

The algorithmic identification and culling of surfaces and line segments that are occluded or hidden from view by other opaque objects along the line of sight from the viewpoint.

The Z-Buffer (Depth-Buffer) Algorithm

A raster image-space algorithm maintaining two buffers: a Frame Buffer (color values) and a Z-Buffer (depth values from viewpoint). When rendering a pixel at (x, y), if its depth z < zbuffer[x, y] (closer to camera), the pixel color is updated and zbuffer[x, y] = z.

What is the Painter's Algorithm (Depth-Sort)

An object-space algorithm that sorts polygons by decreasing distance from the viewpoint (z_{\max}) and paints them into the frame buffer from back-to-front, naturally overwriting distant surfaces with closer ones.

What is Back-Face Culling

A geometric test that culls non-visible polygons of closed polyhedra whose surface normal points away from the viewer: polygon is a back-face if \mathbf{N} \cdot \mathbf{V} > 0 (or A x_{eye} + B y_{eye} + C z_{eye} + D < 0).

Warnock's Area Subdivision Algorithm

An image-space divide-and-conquer algorithm that recursively subdivides display areas into four equal quadrants until each area is either completely empty, completely covered by a single polygon, or reduced to the size of a single pixel.

Conceptual & Architectural Analysis

Derive the Blending Functions for a Cubic Bezier Curve (n=3)

Cubic Bezier Bernstein Polynomials (n=3):

For i = 0, 1, 2, 3 with u \in [0, 1]: $B_{i, 3}(u) = \binom{3}{i} u^i (1 - u)^{3-i}$

  1. B_{0, 3}(u) = \binom{3}{0} u^0 (1 - u)^3 = \mathbf{(1 - u)^3}
  2. B_{1, 3}(u) = \binom{3}{1} u^1 (1 - u)^2 = \mathbf{3u(1 - u)^2}
  3. B_{2, 3}(u) = \binom{3}{2} u^2 (1 - u)^1 = \mathbf{3u^2(1 - u)}
  4. B_{3, 3}(u) = \binom{3}{3} u^3 (1 - u)^0 = \mathbf{u^3}

Partition of Unity Property: $\sum_{i=0}^3 B_{i, 3}(u) = (1 - u)^3 + 3u(1-u)^2 + 3u^2(1-u) + u^3 = [(1 - u) + u]^3 = 1^3 = \mathbf{1}$

Compare Bezier Curves vs B-Spline Curves

DimensionBezier CurveB-Spline Curve
Local ControlNo (Global effect: moving one point alters entire curve)Yes (Moving a point affects only k neighboring segments)
Degree of CurveFixed to n = m - 1 (m = number of points)Chosen independently of number of control points
Basis FunctionsBernstein polynomialsCox-de Boor recursive basis functions
InterpolationInterpolates endpoints P_0 and P_nCan interpolate or approximate based on knot vector
ComplexitySimple mathematical formulaMore complex knot vector calculations

The Z-Buffer Algorithm Flow with Pseudocode

CODE
1Algorithm: Z-Buffer (Depth Buffer)
21. Initialize for all pixels (x, y):
3 FrameBuffer[x, y] = BackgroundColor
4 ZBuffer[x, y] = 1.0 (Maximum Depth / Far Plane)
5
62. For each polygon in the scene:
7 For each pixel (x, y) covered by polygon during scan-conversion:
8 Calculate depth z at pixel (x, y)
9 If z < ZBuffer[x, y]:
10 ZBuffer[x, y] = z
11 FrameBuffer[x, y] = PolygonColor(x, y)
  • Pros: Handles arbitrary polygon overlaps, independent of scene complexity, easily hardware accelerated (modern GPUs).
  • Cons: High memory overhead for depth buffer; susceptible to z-fighting if depth precision is limited.

The Painter's Algorithm and the Problem of Cyclic Overlap

CODE
1 [ Cyclic Overlap Triangle Loop ]
2 Poly A overlaps Poly B
3 Poly B overlaps Poly C
4 Poly C overlaps Poly A
5 (No simple depth sorting order exists!)
  • When polygons cyclically overlap or pierce each other, no valid front-to-back or back-to-front order exists.
  • Resolution: Polygons must be split into sub-polygons using plane partitioning (e.g., BSP Trees).

Back-Face Culling Formulation

For a polygon plane equation Ax + By + Cz + D = 0 with surface normal vector \mathbf{N} = [A, B, C]^T:

  • If the viewing vector from viewer to polygon is \mathbf{V}:

$If \mathbf{N} \cdot \mathbf{V} > 0 \implies Back-face (Culled / Hidden) If \mathbf{N} \cdot \mathbf{V} ≤ 0 \implies Front-face (Visible / Retained)$

  • For orthographic viewing along the negative Z-axis, this simplifies to inspecting the sign of C: if C ≤ 0, the surface is visible.

In-Depth Analysis & Implementation

Prove the Convex Hull and Endpoint Interpolation Properties of Bezier Curves, and Compute Point Coordinates for Given Control Points

Mathematical Proofs of Bezier Properties

1. Endpoint Interpolation Proof:

  • At parameter u = 0:

$B_{0, n}(0) = \binom{n}{0} 0^0 (1 - 0)^n = 1 B_{i, n}(0) = 0 \quad (for all i > 0) \implies P(0) = 1 \cdot P_0 + 0 = \mathbf{P_0}$

  • At parameter u = 1:

$B_{n, n}(1) = \binom{n}{n} 1^n (1 - 1)^0 = 1 B_{i, n}(1) = 0 \quad (for all i < n) \implies P(1) = 1 \cdot P_n + 0 = \mathbf{P_n} *Hence, the curve always begins at P0$ and terminates at $Pn$.*

2. Convex Hull Property Proof:

By definition, a point P is in the convex hull of points \{P_i\} if P = \sum \alpha_i P_i where \alpha_i ≥ 0 and \sum \alpha_i = 1.

  • For u \in [0, 1], each Bernstein basis function B_{i, n}(u) = \binom{n}{i} u^i (1 - u)^{n-i} ≥ 0.
  • By the binomial theorem, \sum_{i=0}^n B_{i, n}(u) = [u + (1 - u)]^n = 1^n = 1.
  • Therefore, for all u \in [0, 1], P(u) is a convex combination of control points, guaranteeing that the curve lies completely inside the polygon formed by its control vertices.

3. Numerical Problem:

  • Given control points: P_0(0, 0), P_1(1, 4), P_2(3, 4), P_3(4, 0).
  • Find the coordinate P(0.5) at the midpoint of the curve:

$B_{0, 3}(0.5) = (1 - 0.5)^3 = 0.125 B_{1, 3}(0.5) = 3(0.5)(0.5)^2 = 0.375 B_{2, 3}(0.5) = 3(0.5)^2(0.5) = 0.375 B_{3, 3}(0.5) = (0.5)^3 = 0.125$

  • Calculate X-coordinate:

$x(0.5) = 0.125(0) + 0.375(1) + 0.375(3) + 0.125(4) = 0 + 0.375 + 1.125 + 0.5 = \mathbf{2.0}$

  • Calculate Y-coordinate:

$y(0.5) = 0.125(0) + 0.375(4) + 0.375(4) + 0.125(0) = 0 + 1.5 + 1.5 + 0 = \mathbf{3.0}$

  • Result: Point on Bezier curve at u = 0.5 is $(2.0, 3.0)$.

Detail Hidden Surface Removal Algorithms: Z-Buffer vs A-Buffer vs Warnock Area-Subdivision

Comprehensive Comparison of Hidden Surface Removal Algorithms

System Architecture / Concept DiagramHorizontal Scroll Enabled
+----------------------------------------------------------------------------------+
|                   HIDDEN SURFACE REMOVAL TAXONOMIES                              |
|                                                                                  |
|  [ Object-Space Algorithms ]                  [ Image-Space Algorithms ]         |
|  - Compare objects directly in 3D world       - Compare at each screen pixel     |
|  - Precision: Arbitrary physical units         - Precision: Frame buffer pixels   |
|  - Examples: Back-Face Culling, Painter's     - Examples: Z-Buffer, A-Buffer     |
+----------------------------------------------------------------------------------+

1. Z-Buffer (Catmull 1974):

  • Compares depth at each pixel. Operates in O(N × pixels) time.
  • Limitation: Handles only opaque surfaces; cannot blend transparent or translucent materials.

2. A-Buffer (Carpenter 1984 - Antialiased, Area-Averaged, Accumulation Buffer):

  • Extends Z-Buffer by associating each pixel with a linked list of surface fragments.
  • Each fragment stores: RGB color, depth z, surface percentage coverage mask, transparency factor, and pointer to next fragment.
  • Enables order-independent transparency blending and edge antialiasing.

3. Warnock's Area Subdivision Algorithm:

  • Evaluates relationships between polygons and candidate rectangular screen quadrant:
  1. Disjoint: Polygon completely outside \implies ignored.
  2. Intersecting: Partially inside \implies subdivided further.
  3. Contained: Completely inside quadrant \implies drawn if unobstructed.
  4. Surrounding: Completely covers quadrant \implies if closest, display its color and stop subdividing.

Implement a Python Script to Calculate and Plot a Cubic Bezier Curve via Bernstein Polynomials

System Architecture / Concept DiagramHorizontal Scroll Enabled
import numpy as np

def bernstein_poly(i, n, t):
    """Calculates Bernstein polynomial B_{i, n}(t)."""
    from math import comb
    return comb(n, i) * (t ** i) * ((1 - t) ** (n - i))

def bezier_curve(control_points, num_points=100):
    """
    Computes 2D Bezier curve from control points array of shape (N+1, 2).
    """
    n = len(control_points) - 1
    t_vals = np.linspace(0.0, 1.0, num_points)
    curve = np.zeros((num_points, 2))
    
    for idx, t in enumerate(t_vals):
        pt = np.zeros(2)
        for i in range(n + 1):
            b = bernstein_poly(i, n, t)
            pt += b * control_points[i]
        curve[idx] = pt
        
    return curve

# Control Points
ctrl_pts = np.array([
    [0.0, 0.0],
    [1.0, 4.0],
    [3.0, 4.0],
    [4.0, 0.0]
])

curve_points = bezier_curve(ctrl_pts, num_points=11)
print("Sampled points along Bezier curve:")
for t_step, pt in zip(np.linspace(0, 1, 11), curve_points):
    print(f"t = {t_step:0.1f} -> ({pt[0]:0.3f}, {pt[1]:0.3f})")

Important Exam Points & Quick Revision

Examiners frequently ask: Bezier Curve properties and Bernstein polynomial formulation (guaranteed 10 marks), Z-buffer vs Painter's algorithm, and local control comparison with B-Splines.

Your reading progress
0%

100% left on this page — finishing it closes the gap for Curves, Surfaces & Spline Representations.

Weak topic hint

Curves, Surfaces & Spline Representations still counts as a weak topic until you finish this note and answer its questions.

Practise this unit
What Should You Do Next?

Test Your Understanding

Now that you've read through these notes, practice unit MCQs to identify weak points and solidify your learning before exams.