---
title: "Bresenham decision parameter, |m| > 1"
subject: "Computer Graphics"
chapter: 2
key: "semester_5/computer_graphics:bresenham-negative-slope-m-gt-1"
source: https://www.bctengineer.com/q/semester_5/computer_graphics/bresenham-negative-slope-m-gt-1
site: BCT Engineering
---

# Bresenham decision parameter, |m| > 1

Computer Graphics · Chapter 2: Scan-Conversion

- Asked in: 2071 Shrawan, 8 marks
- Video: [BRESENHAM's LINE DRAWING ALGORITHM - DERIVATION](https://www.youtube.com/watch?v=U3xpfGxUgF0) — RedInkDotCom
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/computer_graphics/bresenham-negative-slope-m-gt-1
- Whole chapter: https://www.bctengineer.com/md/semester_5/computer_graphics/chapter-2

## Question

Derive the Bresenham's decision parameter to draw a line with negative slope and |m| > 1.

## Short answer

For negative slope with |m|>1, y is decremented by 1. The decision parameter p_0 = 2Δx − |Δy|. If p_k < 0, x unchanged, p_(k+1) = p_k + 2Δx; else x increments, p_(k+1) = p_k + 2Δx − 2|Δy|. Plot after each y decrease.

## Answer

**Case:** line from (x0, y0) to (x1, y1) with x0 < x1 and y0 > y1, slope m = Δy/Δx < −1. So y decreases by exactly 1 in each step, and x either stays or increases by 1.

Let Δx = x1 − x0 and |Δy| = y0 − y1, with |Δy| > Δx. The line is y = m·x + b, or x = (y − b)/m, with m = −|Δy|/Δx.

#### Pixel choice
After plotting (x_k, y_k), the next row is y_k − 1. The candidates are x_k and x_k + 1. The true x at this row is x = (y_k − 1 − b)/m.

```text
d1 = x − x_k           (distance to left pixel)
d2 = (x_k + 1) − x     (distance to right pixel)
d1 − d2 = 2x − 2x_k − 1 = 2(y_k − 1 − b)/m − 2x_k − 1
```

Since 1/m = −Δx/|Δy|, multiplying by |Δy| (positive) gives the decision parameter:

```text
p_k = |Δy|(d1 − d2) = −2Δx(y_k − 1 − b) − 2|Δy|x_k − |Δy|
```

- p_k < 0: d1 < d2, the left pixel is nearer: next point (x_k, y_k − 1).
- p_k ≥ 0: next point (x_k + 1, y_k − 1).

#### Recursive form
```text
p_k+1 − p_k = −2Δx(y_k+1 − y_k) − 2|Δy|(x_k+1 − x_k) = 2Δx − 2|Δy|(x_k+1 − x_k)
```

- x_k+1 = x_k:      p_k+1 = p_k + 2Δx
- x_k+1 = x_k + 1:  p_k+1 = p_k + 2Δx − 2|Δy|

#### Initial value
At (x0, y0) b = y0 − m·x0 = y0 + (|Δy|/Δx)x0, so −2Δx(y0 − 1 − b) = 2Δx + 2|Δy|x0. Then

```text
p_0 = 2Δx + 2|Δy|x0 − 2|Δy|x0 − |Δy| = 2Δx − |Δy|
```

#### Algorithm
```text
Plot (x0, y0); p = 2Δx − |Δy|
Repeat |Δy| times:
    y = y − 1
    if p < 0:  p = p + 2Δx
    else:      x = x + 1;  p = p + 2Δx − 2|Δy|
    plot (x, y)
```

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. For a line with slope m < -1 (x0 < x1, y0 > y1), how does the next pixel move?
   A. x increases by exactly 1; y stays or decreases by 1
   B. y decreases by exactly 1; x stays or increases by 1
   C. y increases by 1; x stays or decreases by 1
   D. Both x and y decrease by 1
   Answer: B. With |m| > 1, y is the unit-step axis (going down) and x changes by 0 or 1. (Key point: Step directions)

2. The initial decision parameter derived for this case is:
   A. p0 = 2|Δy| − Δx
   B. p0 = Δx − 2|Δy|
   C. p0 = 2Δx − |Δy|
   D. p0 = 2Δx + |Δy|
   Answer: C. Substituting b = y0 + (|Δy|/Δx)x0 into p_k at (x0, y0) leaves 2Δx − |Δy|. (Key point: Initial parameter)

3. If p_k < 0, which pixel is chosen next?
   A. (x_k, y_k − 1), because d1 < d2 and the left pixel is nearer
   B. (x_k + 1, y_k − 1), because the right pixel is nearer
   C. (x_k, y_k + 1)
   D. (x_k + 1, y_k)
   Answer: A. p_k = |Δy|(d1 − d2); negative means the true x is closer to x_k, so x stays. (Key point: Choice of pixel)

4. When p_k >= 0 (x increases by 1), the next parameter is:
   A. p_k+1 = p_k + 2Δx
   B. p_k+1 = p_k + 2|Δy| − 2Δx
   C. p_k+1 = p_k − 2Δx
   D. p_k+1 = p_k + 2Δx − 2|Δy|
   Answer: D. p_k+1 − p_k = 2Δx − 2|Δy|(x_k+1 − x_k); with x_k+1 − x_k = 1 this gives 2Δx − 2|Δy|. (Key point: Recursive update)

## Related in Computer Graphics

- [Bresenham decision parameter, negative slope](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Abresenham-negative-slope-derive) — Computer Graphics, chapter 2, asked 2×
- [Midpoint circle algorithm and decision parameter](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Amidpoint-circle-derive) — Computer Graphics, chapter 2, asked 8×
