Download presentation
Presentation is loading. Please wait.
Published byScott Arnold Modified over 8 years ago
1
Clipping
2
Before clipping…
3
After clipping…
4
Point Clipping Display P = (x, y) if xw min <= x <= xw max yw min <= y <= yw max
5
Line Clipping Display P = (x, y) if xw min <= x <= xw max yw min <= y <= yw max Line Clipping If both points lie inside the window display segment
6
Line Clipping (cont) Display P = (x, y) if xw min <= x <= xw max yw min <= y <= yw max Line Clipping If both points lie inside the window display segment If both points lie outside the same boundary discard segment
7
Line Clipping (cont) Display P = (x, y) if xw min <= x <= xw max yw min <= y <= yw max If both points lie inside the window display segment If both points lie outside the same boundary discard segment If segment crosses one or more boundaries calculate intersections with boundaries x = x 1 + u(x 2 - x 1 ) y = y 1 + u(y 2 - y 1 ) if 0 <= u <= 1 display section within boundary else discard segment
8
Cohen - Sutherland Line Clipping 4 bit clip code: A B R L
9
Cohen - Sutherland Line Clipping (cont) 4 bit clip code: A B R L A = y > yw max B = y < yw min R = x > xw max L = x < xw min
10
4 bit clip code: A B R L A = y > yw max B = y < yw min R = x > xw max L = x < xw min Calculate clip code P 1 = 0 0 0 0 P 2 = 0 0 0 0 --- 0 0 0 0 => accept segment P 1 P 2 (trivial accept since both end points are in the window
11
4 bit clip code: A B R L A = y > yw max B = y < yw min R = x > xw max L = x < xw min Calculate clip code P3 = 1 0 0 1 P4 = 1 0 0 0 --- 1 0 0 0 => Reject segment P3 P4
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.