Download presentation
Presentation is loading. Please wait.
Published byElvin Martin Modified over 9 years ago
1
168 471 Computer Graphics, KKU. Lecture 81 Clipping on a Raster Display
2
168 471 Computer Graphics, KKU. Lecture 82 Approaches to Clipping
3
168 471 Computer Graphics, KKU. Lecture 83 Analytical Clipping
4
168 471 Computer Graphics, KKU. Lecture 84 Clipping Lines Against Rectangles
5
168 471 Computer Graphics, KKU. Lecture 85 Clipping Rules
6
168 471 Computer Graphics, KKU. Lecture 86 Computing Intersections
7
168 471 Computer Graphics, KKU. Lecture 87 Cohen-Sutherland Algorithm
8
168 471 Computer Graphics, KKU. Lecture 88 Outcodes
9
168 471 Computer Graphics, KKU. Lecture 89 Outcode Computation typedef unsigned int outcode; enum {TOP = 0x1, BOTTOM = 0x2, RIGHT = 0x4, LEFT = 0x8} outcode CompOutCode( double x, double y, double xmin, double xmax, double ymin, double ymax) { outcode code = 0; if ( y > ymax ) code |= TOP; else if ( y < ymin ) code |= BOTTOM; if ( x > xmax ) code |= RIGHT; else if ( x < xmin ) code |= LEFT; return code; }
10
168 471 Computer Graphics, KKU. Lecture 810 Cohen-Sutherland Procedures
11
168 471 Computer Graphics, KKU. Lecture 811 Cohen-Sutherland Procedures
12
168 471 Computer Graphics, KKU. Lecture 812 Cohen-Sutherland Algorithm
13
168 471 Computer Graphics, KKU. Lecture 813 Cohen-Sutherland Algorithm (cont.)
14
168 471 Computer Graphics, KKU. Lecture 814 Cohen-Sutherland Procedures
15
168 471 Computer Graphics, KKU. Lecture 815 Parametric Line-Clipping Algorithm Introduced by Cyrud and Beck in 1978 Efficiently improved by Liang and Barsky Essentially find the parameter t from P(t) = P 0 + (P 1 -P 0 )t
16
168 471 Computer Graphics, KKU. Lecture 816 Parametric Line-Clipping Algorithm (cont.) Formally, intersections can be classified as PE (potentially entering) and PL (potentially leaving) on the basis of the angle between P 0 P 1 and N i Determine t E or t L for each intersection Select the line segment that has maximum t E and minimum t L If t E > t L, then trivially rejected
17
168 471 Computer Graphics, KKU. Lecture 817 Parametric Line-Clipping Algorithm (cont.)
18
168 471 Computer Graphics, KKU. Lecture 818 Cyrus-Beck Algorithm (Pseudocode)
19
168 471 Computer Graphics, KKU. Lecture 819 Clipping Circles and Ellipses Firstly, do a trivial accept/reject test by intersecting the circle ’ s/elleipse ’ s extent with the clip rectengle. If intersection occurs, divide it into and do the trivial accept/reject test for each. If scan conversion is fast or if the circle is not too large, scissoring on a pixel-by-pixel basis would be more efficient.
20
168 471 Computer Graphics, KKU. Lecture 820 Clipping Polygons Example of polygon clipping, (a) Multiple components. (b) Simple convex case. (c) Concave case.
21
168 471 Computer Graphics, KKU. Lecture 821 Clipping Polygons (cont.) Polygon clipping, edge by edge. (a) Before clipping. (b) Clip on right. (c) Clip on bottom. (d) Clip on left. (e) Clip on top; polygon is fully clipped
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.