---
title: "Cohen-Sutherland: (0,120)-(130,5)"
subject: "Computer Graphics"
chapter: 3
key: "semester_5/computer_graphics:cohen-sutherland-p1-0-120"
source: https://www.bctengineer.com/q/semester_5/computer_graphics/cohen-sutherland-p1-0-120
site: BCT Engineering
---

# Cohen-Sutherland: (0,120)-(130,5)

Computer Graphics · Chapter 3: Two –Dimensional Transformations

- Asked in: 2073 Shrawan, 5 marks
- Video: [Cohen Sutherland Line Clipping Example  | CG | Computer Graphics | Lec-35 | Bhanu priya](https://www.youtube.com/watch?v=21drINjp2dg) — Education 4u
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/computer_graphics/cohen-sutherland-p1-0-120
- Whole chapter: https://www.bctengineer.com/md/semester_5/computer_graphics/chapter-3

## Question

Obtain the end points of the line that connects P1(0,120) and P2(130,5) after Cohen-Sutherland clipping. The clip window has the following parameters: xwmin = 0, ywmin = 0, xwmax = 150 and ywmax = 100.

## Short answer

With window (0,0)-(150,100), the line from (0,120) to (130,5) is clipped. P1 is above y=100, giving (22.61,100). P2 is inside. Final clipped line: (22.61,100) to (130,5).

## Answer

**Given:** P1(0,120), P2(130,5); window xwmin = 0, ywmin = 0, xwmax = 150, ywmax = 100.

Region code (T B R L): bit 1 = 1 if x < xmin, bit 2 = 1 if x > xmax, bit 3 = 1 if y < ymin, bit 4 = 1 if y > ymax. Slope m = (y2 − y1)/(x2 − x1); intersections: y = y1 + m(x − x1) with a vertical edge, x = x1 + (y − y1)/m with a horizontal edge.

Slope m = (5 − 120)/(130 − 0) = −115/130 = −0.8846.

Region codes (T B R L): P1 = 1000, P2 = 0000.

```text
P1=(0,120) code 1000; P2=(130,5) code 0000
Clip P1 against y = ymax = 100: new point (22.61,100)
P1=(22.61,100) code 0000; P2=(130,5) code 0000
Both codes 0000: accept
```

Clipped line: (22.61, 100) to (130, 5).

P1 is above the window (y > 100), so it is moved to y = ymax = 100: x = 0 + (100 − 120)/(−0.8846) = 22.61. P2 = (130,5) is inside.

**Answer: the clipped line joins (22.61, 100) and (130, 5).**

## Check yourself

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

1. With window 0-150 by 0-100, what is the region code (T B R L) of P1(0,120)?
   A. 0001
   B. 1000
   C. 0100
   D. 1001
   Answer: B. y = 120 > ymax gives the top bit, and x = 0 is within the window. (Key point: Region code)

2. Which edge is P1 clipped against?
   A. x = xmin
   B. x = xmax
   C. y = ymax
   D. y = ymin
   Answer: C. P1 is above the window so it is moved to y = 100. (Key point: Which edge)

3. What is the x-value of the intersection at y = 100 (m = -0.8846)?
   A. 22.61
   B. 130
   C. 11.3
   D. -22.61
   Answer: A. x = 0 + (100 - 120)/(-0.8846) = 22.61. (Key point: Intersection)

4. After clipping P1, why is the line accepted?
   A. The slope is negative
   B. Both end points have code 0000
   C. Their AND is nonzero
   D. P2 is outside
   Answer: B. When both codes are 0000, the line is entirely inside and accepted. (Key point: Decision)

## Related in Computer Graphics

- [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
- [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×
- [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

## Related in other subjects

- [Sending end active power from ABCD, 132/130.5 kV](https://www.bctengineer.com/question.md?key=semester_4%2Fpower_system_analysis_i%3Asending-power-132kv-130-5kv) — Power System Analysis I, chapter 6
- [Single stub for 120−j160 Ω on 100 Ω line](https://www.bctengineer.com/question.md?key=semester_7%2Frf_and_microwave_engineering%3Asingle-stub-120-j160) — RF and Microwave Engineering, chapter 2
- [150 mile, 60 Hz line: ABCD and sending end](https://www.bctengineer.com/question.md?key=semester_4%2Fpower_system_analysis_i%3A150-mile-60hz-line-abcd) — Power System Analysis I, chapter 5
