Premium Chapter

Computer graphics basics

Computer Science & Applications (Paper 2) (Code 87) · Unit 3 · ~15 min read · Original chapter

Free previewPremium full chapter

Free preview

Computer graphics turns numbers into pictures. The screen is a grid of pixels, and drawing means deciding which pixels to light up. The classic problem is drawing a straight line on that grid: the DDA algorithm steps along the line computing y = mx + c at each x, while Bresenham's algorithm uses only integer arithmetic and a decision variable to pick the next pixel, which is why it is faster. Worked example: to draw a line from (0, 0) to (4, 2), the slope is 0.5, so DDA gives pixels (0, 0), (1, 1) after rounding 0.5 up, (2, 1), (3, 2) after rounding 1.5 up, and (4, 2). Bresenham picks the same pixels here but without any floating-point arithmetic — and that difference is the exam point.

Checking premium access…