---
title: "Liang-Barsky: (6,100)-(60,5)"
subject: "Computer Graphics"
chapter: 3
key: "semester_5/computer_graphics:liang-barsky-6-100-60-5"
source: https://www.bctengineer.com/q/semester_5/computer_graphics/liang-barsky-6-100-60-5
site: BCT Engineering
---

# Liang-Barsky: (6,100)-(60,5)

Computer Graphics · Chapter 3: Two –Dimensional Transformations

- Asked in: 2075 Asoj, 8 marks
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/computer_graphics/liang-barsky-6-100-60-5
- Whole chapter: https://www.bctengineer.com/md/semester_5/computer_graphics/chapter-3

## Question

Use Liang-Barsky line clipping algorithm to clip a line starting from (6,100) and ending at (60, 5) against the window having its lower left corner at (10, 10) and upper right corner at (90, 90).

## Short answer

Line from (6,100) to (60,5); window (10,10)–(90,90). Δx=54, Δy=−95. p,q yield entering u from left (0.074) and top (0.1053), leaving from right (1.556) and bottom (0.9474). u1=max(0,0.074,0.1053)=0.1053, u2=min(1,0.9474)=0.9474. Clipped endpoints: x1'=6+0.1053×54≈11.68, y1'=100−0.1053×95=90; x2'=6+0.9474×54≈57.16, y2'=100−0.9474×95=10. Clipped line: (11.68, 90) to (57.16, 10).

## Answer

**Given:** P1(6,100), P2(60,5); window xmin = 10, ymin = 10, xmax = 90, ymax = 90.

Parametric line: x = x1 + u·Δx, y = y1 + u·Δy, 0 ≤ u ≤ 1. Here Δx = 60 − 6 = 54, Δy = 5 − 100 = −95.

```text
p1 = −Δx = −54   q1 = x1 − xmin = −4     (left)
p2 =  Δx =  54   q2 = xmax − x1 = 84     (right)
p3 = −Δy =  95   q3 = y1 − ymin = 90     (bottom)
p4 =  Δy = −95   q4 = ymax − y1 = −10    (top)
```
For p < 0 the line enters the window, and u = q/p is a candidate for u1 = max(0, ...); for p > 0 it leaves, and u = q/p is a candidate for u2 = min(1, ...).

| Edge | p | q | u = q/p and remark |
|---|---|---|---|
| left | −54 | −4 | entering, u = 0.074 |
| right | 54 | 84 | leaving, u = 1.556 |
| bottom | 95 | 90 | leaving, u = 0.9474 |
| top | −95 | −10 | entering, u = 0.1053 |

u1 = max(0, entering values) = 0.1053, u2 = min(1, leaving values) = 0.9474.

Since u1 < u2, part of the line is visible.

```text
x1' = x1 + u1·Δx = 6 + 0.1053×54 = 11.68
y1' = y1 + u1·Δy = 100 + 0.1053×(−95) = 90
x2' = x1 + u2·Δx = 6 + 0.9474×54 = 57.16
y2' = y1 + u2·Δy = 100 + 0.9474×(−95) = 10
```

**Answer: the clipped line is from (11.68, 90) to (57.16, 10).**

## Check yourself

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

1. For P1(6,100), P2(60,5), Δx and Δy are?
   A. -54 and 95
   B. 54 and -95
   C. 54 and 95
   D. 66 and -105
   Answer: B. 60-6 = 54 and 5-100 = -95. (Key point: Delta values)

2. Which edge gives u1 = 0.1053?
   A. Left
   B. Bottom
   C. Top (q/p = -10/-95)
   D. Right
   Answer: C. The top edge has p < 0 and gives the largest entering value, larger than the left's 0.074. (Key point: u1 source)

3. Which edge gives u2 = 0.9474?
   A. Right
   B. Top
   C. Left
   D. Bottom (90/95)
   Answer: D. Bottom is leaving with p = 95 > 0 and the smallest value. (Key point: u2 source)

4. What is the clipped line?
   A. (11.68, 90) to (57.16, 10)
   B. (6, 100) to (60, 5)
   C. (10, 90) to (60, 10)
   D. (11.68, 10) to (57.16, 90)
   Answer: A. Substitute u1 and u2. (Key point: Result)

## Related in Computer Graphics

- [Liang-Barsky: P1(-5,3), P2(15,9)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Aliang-barsky-0-0-10-10) — Computer Graphics, chapter 3
- [Liang-Barsky: (5,120)-(80,7)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Aliang-barsky-5-120-80-7) — Computer Graphics, chapter 3
- [Liang-Barsky: (-2,2)-(45,40)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Aliang-barsky-neg2-2-45-40) — Computer Graphics, chapter 3
- [Cohen-Sutherland: two lines vs window A-D](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Acohen-sutherland-two-lines-window-a) — Computer Graphics, chapter 3
- [Cohen-Sutherland: window (10,10)-(40,40)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Acohen-sutherland-window-10-40) — Computer Graphics, chapter 3
- [Cohen-Sutherland line clipping](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Acohen-sutherland-explain) — Computer Graphics, chapter 3, asked 2×

## Related in other subjects

- [Arch 100 m rise 12 m: rolling UDL 60 m, section 10 m](https://www.bctengineer.com/question.md?key=semester_4%2Ftheory_of_structures_i%3Aarch-100m-rise12-udl-60m-10m) — Theory of Structures I, chapter 6
- [Copy string converting lower to upper using pointer](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Apointer-array-elements-copy-string-upper) — Computer Programming, chapter 9, asked 3×
- [8085 ALP: add upper and lower nibbles](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3Aalp-8085-add-nibbles) — Microprocessor, chapter 2
- [Arch 100 m rise 15 m: rolling UDL 10 m, section 60 m](https://www.bctengineer.com/question.md?key=semester_4%2Ftheory_of_structures_i%3Aarch-100m-rise15-udl-10m-60m-section) — Theory of Structures I, chapter 6
