39
2009-1 학학 Chapter 6. Two-Dimensional Viewing 1 Chapter 6. Two-Dimensional Viewing

2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing formal mechanism for displaying

Embed Size (px)

DESCRIPTION

학기 Chapter 6. Two-Dimensional Viewing 3 The Viewing Pipeline  window: 디스플레이를 위한 world-coordinate area  무엇을 나타낼지 정의  보이기 위해 선택된 그림의 영역을 말함  viewport: 윈도우에서 디바이스위에 나타내기 위한 영역  디스플레이 될 위치 정의  viewing transformation: world coordinate scene 을 device coordinates 로 매핑시키는 것 ( 그림 6-2)  window-to-viewport transformation 혹은 windowing transformation 이라고 함

Citation preview

Page 1: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 1

Chapter 6. Two-Dimensional Viewing

Page 2: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 2

Two-dimensional viewing formal mechanism for displaying views of a picture on an output device 보통 그래픽스 패키지에는 정의된 그림의 어느 부분을 디스플레이 할지 그

부분을 디바이스의 어느 부분에 놓을지에 대한 기능을 제공함 view: 전체 그림 영역에서 일부 영역을 지정하여 선택됨 single area 를 지정할 수도 있고 동시 디스플레이나 애니메이션을 보여주기

위해 여러 영역을 선택할 수 있다 .

Page 3: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 3

The Viewing Pipeline window: 디스플레이를 위한 world-coordinate area

무엇을 나타낼지 정의 보이기 위해 선택된 그림의 영역을 말함

viewport: 윈도우에서 디바이스위에 나타내기 위한 영역 디스플레이 될 위치 정의

viewing transformation: world coordinate scene 을 device coordinates 로 매핑시키는 것 ( 그림 6-2) window-to-viewport transformation 혹은 windowing transformation 이라고 함

Page 4: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 4

Figure 6-2 A clipping window and associated viewport

Window

World Coordinates Device Coordinates

XWmin XWmax

YWmin

YWmax

XVmin XVmax

YVmin

YVmax

Page 5: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 5

two-dimensional viewing transformation steps ( 그림 6-3)1) output primitives 와 attributes 를 이용하여 world coordinates 로 장면을 구성2)  world-coordinate plane 상에서 2 차원 viewing-coordinate system 을 설정하고

위도우를 정의 . World coordinates 표현에서 viewing coordinates 로 바꿈3) normalized coordinates 로 viewport 를 정의하고 viewing coordinates 를

normalized coordinates 로 변환4) viewport 밖에 존재하는 부분을 잘라내고 (clipping) viewport 의 부분을

device coordinates 로 전환

Page 6: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 6

Figure 6-3 Two-dimensional viewing-transformation pipeline

Construct World-Coordinate Scene

Using Modeling-Coordinate

Transformations

ConvertWorld-

Coordinatesto ViewingCoordinates

Map ViewingCoordinates to

Normalized Viewing Coordinates Using Window-Viewport

Specifications

Map NormalizedViewport to

DeviceCoordinates

MC

WC VC NVC

DC

Page 7: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 7

Viewing coordinate reference frame  viewing coordinate system 설정 방법 world position 의 한점 p0 = (x0,y0) 를

viewing-coordinate origin 으로 정한다 .1) viewing yv direction 을 정하기 위해 world vector V 를 지정한다 . 벡터 V 를

view up vector 라고 한다 .2) V 가 주어지면 unit vectors v=(vx, vy) 및 u=(ux,uy) 의 성분을 구할 수 있

다 . 이 단위 벡터들이 viewing xvyv축을 world xwyw축으로 정렬시키는 회전 행렬의 첫번째와 두번째 행을 구성한다 .

3) world coordinate positions 을 viewing coordinates 로 바꾸기위한 행렬은 2단계 복합변환 (composite transformation) 으로 구함 ( 그림 6-5)

a) viewing origin 을 world origin 으로 이동b)두 reference frames 가 일치되도록 회전시킨다 .

4) MWC,VC = R • T

Page 8: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 8

Figure 6-5 A viewing-coordinate frame is moved into coincidence with the world frame in two steps

xworld

yworld

xview

yview

x0

y0

xworld

yworld

xview

yview

R

Page 9: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 9

Window-To-Viewport Coordinate Transformation object description 을 viewing reference frame 에서 정의한 후엔 window extents 와

normalized device coordinates 로 viewport 의 범위를 정한 뒤 object description 을 normalized coordinates 로 바꾼다 .

winow-to-viewport mapping ( 그림 6-7) 윈도우에서의 점 (xw,yw) 가 뷰포트에서의 (xv, yv) 로 매핑되기 위해선

xv - xvmin = xw - xwmin

xvmax - xvmin xwmax – xwmin

의 관계가 성립해야 하므로 이 식으로부터 xv = xvmin + (xw - xwmin)sx

yv = yvmin + (yw - ywmin)sy

가 구해지고 여기에서 scaling factors sx, sy 는 다음의 식으로 구해진다 .

Page 10: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 10

Figure 6-7 A point at position (xw, yw) in a designated window is mapped to viewport coordinates (xv, yv).

(xw, yw)(xv, yv)

XWmin XWmax

YWmin

YWmax

XVmin XVmax

YVmin

YVmax

Page 11: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 11

xvmax – xvmin

sx = xwmax - xwmin

yvmax - yvmin

sy = ywmax - ywmin

또 다른 방법으로 윈도우 영역을 뷰포트 영역으로 바꾸는 변환을 이용 fixed position (xwmin, ywmin) 을 이용하여 윈도우 영역을 뷰포트 크기로 크기를

조정하는 scaling transformation 을 수행한다 . scaled window area 를 viewport position 으로 이동시킨다 .

Page 12: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 12

OpenGL Two Dimensional Viewing Functions OpenGL Projection mode

clipping window 와 viewport 를 선택하기 전에 world coordinates 를 screen coordinates 로 변환하기 위한 matrix 의 적절한 모드를 설정해야 한다 .

glMatrixMode (GL_PROJECTION) projection matrix 를 현재 matrix 로 한다 . 처음엔 identity matrix glLoadIdentity ( );

Page 13: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 13

GLU Clipping-Window Function gluOrtho2D (xwwin, xwmax, ywmin, ywmax); // 2D Clipping Window 정의

default coordinates: (xwwin, ywmin) = (-1.0, -1.0) (xwmax, ywmax) = (1, 1)

OpenGL Viewport Function glViewport (xvmin, yvmin, vpWidth, vpHeight) glViewport 함수를 부르지 않으면 default viewport size 와 position 은

display window 와 같다 . 현재 active viewport 의 파라미터 값

glGetInteger (GL_VIEWPORT, vpArray); vpArray: xvmin, yvmin, vpWidth, vpHeight

 

Page 14: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 14

GLUT Display Window 생성 GLUT 초기화

glutInit (&argc, argv); glutInitWindowPosition (xTopLeft, yTopLeft); // default: -1, -1 glutInitWindowSize (dwWidth, dwHeight); // default: 300 by 300 glutCreateWindow (“Title of Display Window”);

GLUT Display Window Mode and Color glutInitDisplayMode (mode); // color mode 선택 (RGB or index) glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); glutClearColor (red, green, blue, alpha); // background color for the display wondow glutClearIndex (index); // display window color, an integer value for a position

within the color table

Page 15: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 15

GLUT Display-Window Identifier multiple display windows 생성시 display-window identifier 로 구분 windowID = glutCreateWindow (“A Display Window”);

Deleting a GLUT Display Window glutDestroyWindow (windowID);

Current GLUT Display Window 생성한 마지막 윈도우거나 다음 명령으로 선택한 윈도우 glutSetWindow (windowID); currentWindowID = glutGetWindow( ); // current display window

Page 16: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 16

Relocating and resizing a GLUT Window glutPositionWindow (xNewTopLeft, yNewTopLeft); glutReshapeWindow (dwNewWidth, dwNewHeight); glutFullScreen ( );

Managing Multiple GLUT Display Windows glutIconifyWindow ( ); // convert the current display window to an icon glutSetIconTitle (“Icon Name”); // change icon name glutSetWindowTitle (“New Window Name”); // change the name of the display

window glutSetWindow (windowID); // 현재 윈도우 선택 후 glutPopWindow ( ); // 맨 앞으로 디스플레이 glutSetWindow (windowID); // 현재 윈도우 선택 후 glutPushWindow ( ); // 맨 뒤로 보냄 glutHideWindow ( ); // 현재 윈도우를 숨김 glutShowWindow ( ); // 숨긴 윈도우를 부름

 

Page 17: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 17

GLUT Subwindows display wondow 를 여러 부분으로 나눌 때 사용 glutCreateSubWindow (wundowID, xBottomLeft, yBottomLeft, width, height);

Selecting a Display-Window Screen-Cursor Shape glutSetCursor (shape); // request a shape for the screen cursor

Viewing Graphics Objects in a GLUT Display Window glutDisplayFunc (pictureDescript) ; // pictureDescript: 현재 윈도우에

디스플레이 할 내용을 기술하는 callback function, OpenGL primitives and attributes 포함

glutPostRedisplay ( ); // 현재 윈도우의 내용을 갱신

Executing the Application Program glutMainLoop ( ); // 윈도우와 그래픽 내용이 스크린으로 보내짐

Page 18: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 18

Other GLUT Functions glutIdleFunc (function); // a background function or a procedure to update parameters glutGet (stateParam); // current state parameters

OpenGL Two-Dimensional Viewing Program Example 책 참고

Page 19: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 19

Clipping Operations applications of clipping

extracting part of a defined scene for viewing identifying visible surfaces in three-dimensional views antialiasing line segments or object boundaries creating objects using solid-modeling procedures displaying a multiwindow environment

Clipping algorithms 의 종류 Point clipping Line clipping (straight-line segments) Area clipping (polygons) Curve clipping Text clipping

Page 20: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 20

Point Clipping clip window 가 직사각형이라고 가정했을 때 디스플레이를 위해 다음 조건을

만족하는 점 (x, y) 를 저장한다 . xwmin <= x <= xwmax

ywmin <= y <= ywmax

Page 21: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 21

Line Clipping ( 그림 6-11) line-clipping procedure:

주어진 line segment 가 완전히 clipping window 내부에 놓여져 있는가를 테스트하여 아니면

완전히 윈도우 외부에 놓여있는지 테스트하여 둘 다 아니면 선분이 완전히 내부 혹은 외부에 놓여있는지를 확인하기 어려울 경우엔

clipping boundaries 에 대해 intersection calculations 를 수행한다 . 각 선분을 따라 선분의 양 끝점을 조사하여 inside-outside 테스트를

수행한다 .

Page 22: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 22

Figure 6-11 Line clipping against a rectangular clip window

P3

P4

P5

P6P1

P2

P7

P8

P9

P10

P6P1

P2

P7’

P8’

P5’

Page 23: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 23

선분의 양끝점이 (x1, y1), (x2, y2) 라고 할 때 다음의 parametric representation x = x1 + u (x2 - x1) y = y1 + u (y2 - y1), 0 <= u <= 1을 이용하여 교차점을 위한 파라미터 u 값을 결정할 수 있다 .

u 가 0 과 1 사이 밖에 있을 때는 선분은 윈도우 경계선과 만나지 않음

u 가 0 과 1 사이일 때는 선분은 윈도우 경계선을 교차함 이러한 parametric tests 는 계산량이 많다 .

예를 들어 left window boundary 위치는 xwmin 이므로 이 값을 x 로 하고 u 에 대해

풀면 y-intersection value 가 구해짐 u 가 0 과 1 사이에 없으면 이 선분은 윈도우 경계선과 만나지 않는다 .

Page 24: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 24

Cohen-Sutherland Clipping 그림 내 모든 line end point 에 four-digit binary code (region code) 를 부여하여

clipping rectangle 의 경계선과의 비교 위치를 알아냄 ( 그림 6-13) bit 1: left bit 2: right bit 3: below bit 4: above

clipping window 내부에 있는 점의 region code 는 0000 이 됨 region code 의 각 bit value 는 선분의 양 끝점 (x, y) 와 clip boundaries 를

비교하여 결정됨 x < xwmin이면 bit 1 이 1 로 세트됨

Page 25: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 25

Figure 6-13 Binary region codes

0 0 0 00 0 0 1 0 0 1 0

1 0 0 1 1 0 0 0 1 0 1 0

0 1 0 1 0 1 0 0 0 1 1 0

bit 1: leftbit 2: rightbit 3: belowbit 4: above

Page 26: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 26

clipping algorithm1)모든 line endpoints 에 대해 region codes 를 구함2)두 점의 region code 가 0000 이면 내부에 위치하므로 accept3)같은 bit position 의 region code 가 1 이면 외부에 위치하므로 제외 , 즉

logical and operation 값이 0000 이 아니면 외부에 존재하므로 reject4)위와 같이 completely inside 혹은 completely outside 가 아닌 경우엔 윈도우

경계선과의 intersection 검사하여 선분의 끝점과 경계선과의 교차점 사이의 선분을 제거해 간다 .

Page 27: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 27

( 그림 6-14) intersection points 는 line equation 의 slope-intercept form 을 이용하여 계산될 수

있다 . 양 끝점이 (x1, y1), (x2, y2) 인 선분이 수직의 경계선과의 교차점의 y 값은 y = y1 + m(x - x1) 으로 구할 수 있다 .

마찬가지로 , 수평의 경계선과 선분과의 교차점은 x = x1 + (y - y1) / m 으로 구한다 .

Page 28: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 28

Figure 6-14 Clipping lines

P1

P2

P3

P4

P1’

P2’

P2”

P3’

Page 29: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 29

Polygon Clipping

polygon 을 clip 할 경우엔 line clipping procedure 를 수정할 필요가 있음 왜냐하면 unconnected line segments 만 남을 수 있슴 ( 그림 6-21) polygon clipper 는 clipped polygon boundaries 를 정의하는 정점들이 되어야

함 Sutherland-Hodgeman Polygon Clipping

모든 polygon vertices 를 각 윈도우 경계선에 대해 차례로 처리해감 ( 그림 6-23) 처음엔 left rectangle boundary 에 대해 polygon 을 clip 하여 새로운

vertices 를 구함 그 다음엔 right boundary clipper, bottom boundary clipper, top boundary

clipper 순으로 polygon 을 clip 해 간다 . 각 단계에서 생성된 새로운 정점들을 다음 단계로 전함 .

Page 30: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 30

Figure 6-21 Display of a polygon processed by a line-clipping algorithm

Page 31: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 31

Figure 6-23 Clipping a polygon against succesive window boundaries

Page 32: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 32

4 가지 경우가 발생 : polygon vertices 중 2 개 인접한 정점들이 window clipper에 전달되면서 다음의 테스트를 거침 ( 그림 6-26) first vertex 가 outside 에 있고 second vertex 가 inside 에 있으면 intersection

point 와 second vertex 를 output vertex list 에 저장 first, second vertex 가 모두 inside 에 있을 경우엔 second vertex 만 output list

에 첨가 first vertex 가 inside 에 있고 second vertex 가 outside 에 있으면 intersection

point 만 output vertex list 에 첨가 first, second vertex 가 모두 outside 에 있는 경우엔 아무것도 첨가하지 않음

Page 33: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 33

Figure 6-26 Successive processing of pairs of polygon vertices against the left window boundary

v2v1’

v1

v2v1

v2 v1’ v1

v2

Page 34: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 34

Weiler-Atherton Polygon Clipping Sutherland-Hodgeman clipper 는 concave polygon 처리시 문제 발생 ( 그림 6-

28) vertices 를 처리해 갈 때 polygon edges 를 따라 clipping 해가는 것이

아니라 window boundaries 를 따르기도 함 ( 그림 6-29) 어떤 path 를 따르냐는 polygon-processing direction (clockwise or

counterclockwise) 과 polygon vertex pair 가 outside-to-inside pair 냐 inside-to-outside pair 냐에 따라 결정됨

두 polygon vertex 가 clockwise 일 경우 다음의 rule 을 따름 outside-to-inside pair 의 경우엔 polygon boundary 를 따름 inside-to-outside pair 의 경우엔 window boundary 를 따름

 

Page 35: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 35

Figure 6-28 Clipping the concave polygon with the Sutherland-Hodgeman clipper

Page 36: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 36

Figure 6-29 Clipping a concave polygon with the Weiler-Atherton algorithm

v1

v1’v2

v3v3’

v4 v4’

v5v5’

v6

* For an outside-to-inside pair of vertices, follow the polygon boundary* For an inside-to-outside pair of vertices, follow the window boundary in a clockwise direction

Page 37: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 37

Curve Clipping nonlinear equation 포함 more processing than objects with linear boundaries ( 그림 6-32) => 책 참고

Page 38: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 38

Text Clipping => 책 참고 all-or-none string-clipping technology ( 그림 6-33) all-or-none character-clipping technology ( 그림 6-34) clip the components of individual characters ( 그림 6-35) 

Page 39: 2009-1 학기 Chapter 6. Two-Dimensional Viewing 1. 2009-1 학기 Chapter 6. Two-Dimensional Viewing 2 Two-dimensional viewing  formal mechanism for displaying

2009-1 학기 Chapter 6. Two-Dimensional Viewing 39