Presentation is loading. Please wait.

Presentation is loading. Please wait.

NOTE.

Similar presentations


Presentation on theme: "NOTE."— Presentation transcript:

1 NOTE

2 DDA Line Drawing Algorithm
y y x x

3 Bresenham’s Line Drawing Algorithm

4 Bresenham’s Line Drawing Algorithm

5 Scan Line Polygon Filling
B A

6 2 If the scan line is crossing a vertex, treat it as two intersection points 2 2 2 2

7 2 If the scan line is crossing a vertex, treat it as two intersection points Except the slops of neighboring edges are increasing/decreasing monotonically. 1 2 2 2

8 If the scan line is crossing a vertex, treat it as two intersection points
Except the slops of neighboring edges are increasing/decreasing monotonically. Separate these edges  Is it really necessary?

9 Edge Table Active Edge List

10 Edge Table Add & Sort !! Active Edge List

11 Edge Table Sort !! Active Edge List

12 Edge Table Add & Sort !! Active Edge List

13 Edge Table Active Edge List

14 Edge Table Active Edge List

15 Edge Table Active Edge List

16 Edge Table Active Edge List

17 Edge Table Active Edge List

18 Edge Table Active Edge List

19 Edge Table Active Edge List

20 Edge Table Active Edge List

21 Edge Table Sort !! Active Edge List

22 Edge Table Active Edge List

23 Edge Table Active Edge List

24 Edge Table Empty Active Edge List

25 Scan Line Polygon Filling
Construct the Edge Table (ET) excluding horizontal edge; Active Edge List (AEL) = null; for y = Ymin to Ymax Merge-sort ET[y] into AEL by x value Fill between pairs of x in AEL for each edge in AEL if edge.ymax = y remove edge from AEL else edge.x = edge.x + dx/dy sort AEL by x value end scan_fill

26 Boundary Polygon Filling
Proceed to Neighboring Pixels 4-Connected 8-Connected

27 Inside/Outside Test Self-Intersections Odd-Even rule
Nonzero winding number rule

28 Anti-aliasing - Supersampling
Subpixels increase resolution Maximum intensity level: 9 or more 22 1 2 4 21 20 10 11 12

29 Anti-aliasing - Filtering
Box Filter Cone Filter Gaussian Filter

30 Anti-aliasing – Area sampling
22 21 20 10 11 12

31 Transformation Matrices using Homogeneous Coordinates
2D Affine Transformation Translation Rotation Scaling Shear Mirror

32 Transformation Matrices using Homogeneous Coordinates
Basic 2D transformations as 3x3 matrices Translation Scaling Rotation Shear

33 Transformation Matrices using Homogeneous Coordinates
Reflection with respect to an axis X Axis Y Axis Origin 1 3 2 1’ 3’ 2’ x y 3 1’ 3’ 2’ 1 2 x y x y 1 3 2 1’ 3’ 2’

34 Transformation Matrices using Homogeneous Coordinates
Combined transformations By matrix multiplication Efficiency with pre-multiplication Matrix multiplication is associative

35 Pivot Point Rotation Fixed Point Scaling

36 Pivot Point Rotation (0,0) (1,0) (1,1) (0,1) hx= 0.5 yref= -1 yref= –1
(0.5,0) (1.5,0) (2,1) (0,0) (1,0) (1,1) (0,1) hy= 0.5 xref= -1 x y (0,0.5) (1,2) (0,1.5) xref= –1

37 Is the point (x, y) inside the clipping window?
Point Clipping Is the point (x, y) inside the clipping window? wy2 Inside = (x>=wx1) && (x<=wx2) && (y>=wy1) && (y<=wy2); (x, y) wy1 wx1 wx2

38 Cohen-Sutherland Line Clipping
Classify some lines quickly AND of bit codes of two endpoints (0 if not fully outside) P7 1001 0001 0101 Bit 4 P1 P4 P8 1000 P3 0000 0100 P2 P6 P10 Bit 3 1010 0010 0110 P5 P9 Bit 1 Bit 2

39 Sutherland-Hodgeman Polygon Clipping
Clip to each window boundary at a time

40 Sutherland-Hodgeman Polygon Clipping
Clip to each window boundary at a time

41 Sutherland-Hodgeman Polygon Clipping
Clip to each window boundary at a time

42 Sutherland-Hodgeman Polygon Clipping
Clip to each window boundary at a time

43 Sutherland-Hodgeman Polygon Clipping
Clip to each window boundary at a time

44 Sutherland-Hodgeman Polygon Clipping
Clip to each window boundary at a time P2 P1 Window Boundary Inside Outside P5 P3 P4

45 Sutherland-Hodgeman Polygon Clipping
Clip to each window boundary at a time P2 P1 Window Boundary Inside P’ P” Outside P5 P3 P4

46 Sutherland-Hodgeman Polygon Clipping
Clip to each window boundary at a time P2 P1 Window Boundary Inside P’ P” Outside

47 Viewport Transformation
Transform 2D geometric primitives From screen coordinate (projection coordinates) To image coordinate (device coordinates) Screen Image Viewport

48 Viewport Transformation
Window-to-viewport mapping Window Viewport wy2 vy2 (wx, wy) (vx, vy) wy1 vy1 wx1 wx2 vx1 vx2 Screen Coordinates Image Coordinates vx = vx1 + (wx – wx1) * (vx2 – vx1) / (wx2 – wx1); vy = vy1 + (wy – wy1) * (vy2 – vy1) / (wy2 – wy1);


Download ppt "NOTE."

Similar presentations


Ads by Google