📘 Point and Line Drawing Techniques — Exam Notes
🔹 1. Introduction
Point and Line Drawing Techniques are fundamental methods in computer graphics used to display basic geometric primitives like points and lines on a screen.
👉 These are the building blocks for drawing complex shapes and images.
🔹 2. Point Drawing (Pixel Plotting)
✔️ Definition
A point is the smallest graphical element displayed on the screen, represented by a pixel at a specific coordinate (x, y).
✔️ How a Point is Drawn
- Specify coordinates (x, y)
- Assign a color value
- Store in frame buffer
- Display on screen
✔️ Example
To draw a point at (5, 10):
- Activate pixel at row = 10, column = 5
✔️ Diagram Description
- Draw X-axis and Y-axis
- Mark a point at (x, y)
- Show it as a single filled dot
🔹 3. Line Drawing
✔️ Definition
A line is a continuous set of points between two endpoints:
[
(x_1, y_1) \quad \text{and} \quad (x_2, y_2)
]
✔️ Challenges in Line Drawing
- Pixels are discrete (not continuous)
- Need to choose best pixels to approximate a straight line
- Efficiency is important
🔹 4. Line Drawing Algorithms
🔸 4.1 DDA Algorithm (Digital Differential Analyzer)
✔️ Concept
- Uses incremental calculation
- Calculates intermediate points between endpoints
✔️ Steps
-
Calculate:
[
dx = x_2 - x_1,\quad dy = y_2 - y_1
]
-
Find number of steps:
[
steps = \max(|dx|, |dy|)
]
-
Calculate increments:
[
x_{inc} = \frac{dx}{steps},\quad y_{inc} = \frac{dy}{steps}
]
-
Start from (x₁, y₁)
-
Repeat:
- Plot (x, y)
- Update:
[
x = x + x_{inc},\quad y = y + y_{inc}
]
✔️ Example
Draw line from (2, 2) to (6, 4):
- dx = 4, dy = 2
- steps = 4
- x_inc = 1, y_inc = 0.5
Points:
(2,2), (3,2.5), (4,3), (5,3.5), (6,4)
✔️ Advantages
- Simple to understand
- Easy implementation
✔️ Disadvantages
- Uses floating-point operations
- Less efficient
🔸 4.2 Bresenham’s Line Algorithm
✔️ Concept
- Uses integer calculations only
- More efficient than DDA
✔️ Idea
- Decide which pixel is closer to the true line
- Use a decision parameter
✔️ Steps (for slope < 1)
-
Input endpoints (x₁, y₁), (x₂, y₂)
-
Calculate:
[
dx = x_2 - x_1,\quad dy = y_2 - y_1
]
-
Initialize decision parameter:
[
p = 2dy - dx
]
-
Start from (x₁, y₁)
-
For each x:
-
If ( p < 0 ):
→ Next point = (x+1, y)
→ ( p = p + 2dy )
-
Else:
→ Next point = (x+1, y+1)
→ ( p = p + 2dy - 2dx )
✔️ Example (Simple)
Line from (0,0) to (5,3)
- dx = 5, dy = 3
- p = 2(3) − 5 = 1
Then calculate points step by step using decision parameter.
✔️ Advantages
- Fast and efficient
- Uses integer arithmetic
- Widely used in graphics systems
✔️ Disadvantages
🔹 5. Comparison: DDA vs Bresenham
| Feature |
DDA Algorithm |
Bresenham Algorithm |
| Calculation |
Floating-point |
Integer-based |
| Speed |
Slower |
Faster |
| Accuracy |
Less accurate |
More accurate |
| Complexity |
Simple |
Moderate |
🔹 6. Important Terms
- Pixel: Smallest display unit
- Resolution: Number of pixels
- Slope (m):
[
m = \frac{dy}{dx}
]
- Decision Parameter: Helps choose next pixel
🔹 7. Diagram Descriptions
✔️ Line Drawing
- Draw a grid (pixels)
- Mark start and end points
- Show approximate line using filled pixels
✔️ DDA Representation
- Show incremental steps along line
✔️ Bresenham Representation
- Show two possible pixels at each step
- Highlight chosen pixel
📝 Likely Exam Questions
- Define point and line in computer graphics.
- Explain point plotting with example.
- Describe DDA line drawing algorithm with steps.
- Explain Bresenham’s line algorithm.
- Compare DDA and Bresenham algorithms.
- What are the challenges in line drawing?
- Define slope and decision parameter.
- Solve a numerical using DDA algorithm.
⚡ Quick Revision Summary
-
Point = Single pixel at (x, y)
-
Line = Set of connected pixels
-
DDA Algorithm = Uses floating-point increments
-
Bresenham Algorithm = Uses integer calculations
-
Bresenham is faster and more efficient
-
Key formulas:
- ( dx = x_2 - x_1 ), ( dy = y_2 - y_1 )
- ( m = dy/dx )