ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    HCI & Computer Graphics
    COMP3145
    Progress0 / 73 topics
    Topics
    1. The Human: Input-output channels2. Human memory3. Thinking, Reasoning, Problem solving4. Emotions and Individual differences5. Psychology and design of interacting systems6. The Computer: Text entry devices7. Positioning, Pointing, and drawing devices8. Display devices9. Devices for virtual reality and 3D interaction10. Physical controls, Sensors and special devices11. Paper printing and scanning12. Memory, Processing and networks13. The Interaction: Models of interaction14. Frameworks and HCI15. Ergonomics16. Interaction styles17. Elements of the WIMP interfaces18. Interactivity and Context of interaction19. Usability Paradigm and Principles: Introduction20. Paradigms for interaction21. Interaction Design Basics: What is design22. Process of design and User focus23. Navigation design24. Screen design and layout25. Iteration and prototyping26. HCI in Software Process: Software life cycle27. Usability engineering28. Iterative design and prototyping29. Design rationale30. Design rules and Guidelines31. Golden rules and heuristics32. HCI patterns33. Evaluation techniques and methods34. Task analysis35. Universal design36. User support systems37. Computer Supported Cooperative Work38. Groupware systems39. Implementation of synchronous groupware40. Ubiquitous computing41. History of Computer Graphics42. Graphics architectures and software43. Imaging and vision: Pinhole camera, Human vision, Synthetic camera44. Modeling vs. rendering45. OpenGL Architecture46. Displaying simple two-dimensional geometric objects47. Positioning systems and windowed environment48. Color perception and models49. RGB, CMY, HLS color models50. Color transformations51. Color in OpenGL: RGB and indexed color52. Input: Network environment and client-server computing53. Input measures: event, sample and request input54. Using callbacks and picking55. Affine transformations: translation, rotation, scaling, shear56. Homogeneous coordinates and concatenation57. Current transformation and matrix stacks58. Three Dimensional Graphics: Classical viewing59. Specifying views in 3D60. Affine transformation in 3D61. Projective transformations62. Ray tracing63. Shading: Illumination and surface modeling64. Phong shading model65. Polygon shading66. Rasterization: Line drawing via Bresenham's algorithm67. Clipping and polygonal fill68. BitBlt operations69. Hidden surface removal (z buffer)70. Discrete Techniques: Buffers71. Reading and writing bitmaps and pixel maps72. Texture mapping73. Compositing
    COMP3145›Rasterization: Line drawing via Bresenham's algorithm
    HCI & Computer GraphicsTopic 66 of 73

    Rasterization: Line drawing via Bresenham's algorithm

    5 minread
    765words
    Beginnerlevel

    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 load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time5 min
      Word count765
      Code examples0
      DifficultyBeginner