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

# Liang-Barsky: (5,120)-(80,7)

Computer Graphics · Chapter 3: Two –Dimensional Transformations

- Asked in: 2072 Kartik, 8 marks
- Video: [Liang Barsky Line Clipping Algorithm Numerical 1 Explained in Hindi l Computer Graphics Series](https://www.youtube.com/watch?v=KPvMJNSQi7A) — 5 Minutes Engineering
- 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-5-120-80-7
- Whole chapter: https://www.bctengineer.com/md/semester_5/computer_graphics/chapter-3

## Question

Find the clipped region in window of diagonal vertex (10,10) and (100,100) for line P1 (5,120) and P2 (80,7) using Liang-Barsky line clipping method.

## Short answer

Using Liang-Barsky with window (10,10)-(100,100) on line (5,120)-(80,7), u1=0.177, u2=0.9735, giving clipped points (18.27,100) and (78.01,10).

## Answer

**Given:** P1(5,120), P2(80,7); window xmin = 10, ymin = 10, xmax = 100, ymax = 100.

Parametric line: x = x1 + u·Δx, y = y1 + u·Δy, 0 ≤ u ≤ 1. Here Δx = 80 − 5 = 75, Δy = 7 − 120 = −113.

```text
p1 = −Δx = −75    q1 = x1 − xmin = −5      (left)
p2 =  Δx =  75    q2 = xmax − x1 = 95      (right)
p3 = −Δy =  113   q3 = y1 − ymin = 110     (bottom)
p4 =  Δy = −113   q4 = ymax − y1 = −20     (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 | −75 | −5 | entering, u = 0.067 |
| right | 75 | 95 | leaving, u = 1.267 |
| bottom | 113 | 110 | leaving, u = 0.9735 |
| top | −113 | −20 | entering, u = 0.177 |

u1 = max(0, entering values) = 0.177, u2 = min(1, leaving values) = 0.9735.

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

```text
x1' = x1 + u1·Δx = 5 + 0.177×75 = 18.27
y1' = y1 + u1·Δy = 120 + 0.177×(−113) = 100
x2' = x1 + u2·Δx = 5 + 0.9735×75 = 78.01
y2' = y1 + u2·Δy = 120 + 0.9735×(−113) = 10
```

**Answer: the clipped line is from (18.27, 100) to (78.01, 10).**

## Check yourself

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

1. For P1(5,120), P2(80,7), what are Δx and Δy?
   A. -75 and 113
   B. 75 and -113
   C. 75 and 113
   D. 85 and -127
   Answer: B. Δx = 80 - 5 and Δy = 7 - 120. (Key point: Delta values)

2. Which edge gives u1 = 0.177?
   A. Left
   B. Bottom
   C. Top
   D. Right
   Answer: C. q4/p4 = -20/-113 = 0.177 is the largest entering value. (Key point: Entering value)

3. Why is part of the line visible?
   A. u1 = 0
   B. p = 0
   C. u2 > 1
   D. u1 < u2
   Answer: D. 0.177 < 0.9735 so a segment remains. (Key point: Visibility test)

4. What is the clipped line?
   A. (18.27, 100) to (78.01, 10)
   B. (5, 120) to (80, 7)
   C. (10, 100) to (80, 10)
   D. (18.27, 10) to (78.01, 100)
   Answer: A. Substituting u1 and u2 in the parametric equations gives these points. (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: (6,100)-(60,5)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Aliang-barsky-6-100-60-5) — 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: 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
- [Point clipping and Cohen-Sutherland (5,130)-(50,5)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Acohen-sutherland-point-clip-5-130) — Computer Graphics, chapter 3
