ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalCOMP3145Rasterization Bresenha…
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    COMP3145

    HCI & Computer Graphics

    Progress0 / 73 done
    Topics73
    1Input-output channels2Human memory3Thinking, Reasoning, Problem solving4Emotions and Individual differences5Psychology and design of interacting systems
    6Text entry devices7Positioning, Pointing, and drawing devices8Display devices9Devices for virtual reality and 3D interaction10Physical controls, Sensors and special devices11Paper printing and scanning12Memory, Processing and networks
    13Models of interaction14Frameworks and HCI15Ergonomics16Interaction styles17Elements of the WIMP interfaces18Interactivity and Context of interaction
    19Introduction20Paradigms for interaction
    21What is design22Process of design and User focus23Navigation design24Screen design and layout25Iteration and prototyping
    26Software life cycle27Usability engineering28Iterative design and prototyping29Design rationale30Design rules and Guidelines31Golden rules and heuristics32HCI patterns33Evaluation techniques and methods34Task analysis35Universal design36User support systems37Computer Supported Cooperative Work38Groupware systems39Implementation of synchronous groupware40Ubiquitous computing41History of Computer Graphics42Graphics architectures and software
    43Pinhole camera, Human vision, Synthetic camera44Modeling vs. rendering45OpenGL Architecture46Displaying simple two-dimensional geometric objects47Positioning systems and windowed environment48Color perception and models49RGB, CMY, HLS color models50Color transformations
    51RGB and indexed color
    52Network environment and client-server computing
    53event, sample and request input54Using callbacks and picking
    55translation, rotation, scaling, shear56Homogeneous coordinates and concatenation57Current transformation and matrix stacks
    58Classical viewing59Specifying views in 3D60Affine transformation in 3D61Projective transformations62Ray tracing
    63Illumination and surface modeling64Phong shading model65Polygon shading
    66Line drawing via Bresenham's algorithm67Clipping and polygonal fill68BitBlt operations69Hidden surface removal (z buffer)
    70Buffers71Reading and writing bitmaps and pixel maps72Texture mapping73Compositing
    5 min read
    Topic 66 of 73
    Topic Study Note Illustration
    66

    Rasterization: Line drawing via Bresenham's algorithm

    Rasterization is the process of converting geometric primitives (like lines, polygons) into pixels on a display screen.

    1. Rasterization

    Rasterization is the process of converting geometric primitives (like lines, polygons) into pixels on a display screen.

    • It is a fundamental step in rendering 2D and 3D graphics.
    • The goal is to determine which pixels on the screen should be illuminated to best represent a line, circle, or polygon.
    • For lines, we need efficient algorithms to decide pixel positions along the line path.

    2. Line Drawing

    Problem

    • A line is defined by endpoints (x0,y0)(x_0, y_0)(x0​,y0​) and (x1,y1)(x_1, y_1)(x1​,y1​).
    • On a raster display, we need to select discrete pixel positions to approximate the line.
    • Simple slope-based methods may require floating-point operations and can be slow.

    3. Bresenham’s Line Drawing Algorithm

    Bresenham’s Algorithm is an efficient integer-based line rasterization algorithm.

    • Uses only integer addition, subtraction, and comparison (no floating-point arithmetic).
    • Ideal for fast and accurate line drawing in raster displays.

    Algorithm Concept

    1. Consider a line with slope 0≤m≤10 \le m \le 10≤m≤1 (general case; other slopes are handled similarly).
    2. Start at pixel (x0,y0)(x_0, y_0)(x0​,y0​).
    3. Move one step in x each iteration.
    4. Decide whether to keep y the same or increment y by 1 based on a decision parameter ppp.

    Steps

    Initialization

    Δx=x1−x0,Δy=y1−y0\Delta x = x_1 - x_0, \quad \Delta y = y_1 - y_0Δx=x1​−x0​,Δy=y1​−y0​ p0=2Δy−Δxp_0 = 2 \Delta y - \Delta xp0​=2Δy−Δx
    • p0p_0p0​ is the initial decision parameter.

    Iterative Step

    For each xkx_kxk​ from x0x_0x0​ to x1x_1x1​:

    1. Plot pixel at (xk,yk)(x_k, y_k)(xk​,yk​)

    2. If pk<0p_k < 0pk​<0:

      • Next pixel: (xk+1,yk)(x_{k+1}, y_k)(xk+1​,yk​)
      • Update decision parameter:
    pk+1=pk+2Δy p_{k+1} = p_k + 2 \Delta ypk+1​=pk​+2Δy
    1. Else:

      • Next pixel: (xk+1,yk+1)(x_{k+1}, y_{k}+1)(xk+1​,yk​+1)
      • Update decision parameter:
    pk+1=pk+2Δy−2Δx p_{k+1} = p_k + 2 \Delta y - 2 \Delta xpk+1​=pk​+2Δy−2Δx
    • Repeat until reaching (x1,y1)(x_1, y_1)(x1​,y1​).

    Advantages

    • Uses integer calculations only → fast and suitable for hardware implementation.
    • Produces accurate and visually continuous lines.
    • Works for all line slopes with minor modifications.

    Example

    Line from (2,3)(2, 3)(2,3) to (10,7)(10, 7)(10,7):

    1. Δx=8,Δy=4\Delta x = 8, \Delta y = 4Δx=8,Δy=4
    2. Initial decision parameter: p0=2⋅4−8=0p_0 = 2 \cdot 4 - 8 = 0p0​=2⋅4−8=0
    3. Start at (2,3)(2, 3)(2,3), update pixel coordinates based on pkp_kpk​ for each x-step.

    5. Summary

    Aspect Description
    Purpose Convert a line into pixels on raster display
    Algorithm Bresenham’s line drawing algorithm
    Operations Integer addition, subtraction, comparison (no floating-point)
    Advantages Fast, accurate, hardware-friendly
    Limitation Must handle different slopes separately

    Key Points:

    • Rasterization converts continuous geometry to discrete pixels.
    • Bresenham’s algorithm is efficient, integer-based, and widely used for line drawing.
    • Variants exist for steep slopes, negative slopes, and 3D lines.
    ← Previous topic 65
    Polygon shading
    Next topic 67 →
    Clipping and polygonal fill

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    5mremaining
    765words
    Beginnerlevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    HCI & Computer Graphics