- 2073 Shrawan · 5 marks
Cohen-Sutherland: (0,120)-(130,5)
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).
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.
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.
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).
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Point clipping and Cohen-Sutherland (5,130)-(50,5) · Computer Graphics, chapter 3
- Cohen-Sutherland: two lines vs window A-D · Computer Graphics, chapter 3
- Cohen-Sutherland: window (10,10)-(40,40) · Computer Graphics, chapter 3
- Cohen-Sutherland line clipping · Computer Graphics, chapter 3 · asked 2×
- Liang-Barsky: P1(-5,3), P2(15,9) · Computer Graphics, chapter 3
- Sending end active power from ABCD, 132/130.5 kV · Power System Analysis I, chapter 6
- Single stub for 120−j160 Ω on 100 Ω line · RF and Microwave Engineering, chapter 2
- 150 mile, 60 Hz line: ABCD and sending end · Power System Analysis I, chapter 5