1 / 22

Two-Dimensional Viewing

Two-Dimensional Viewing. 6. Contents. Window and Viewport The Viewing Transformation Window-to-Viewport coordinate transformation Point clipping Line clipping Polygon clipping Exterior clipping. Window and Viewport. Window A world-coordinate area selected for display

Télécharger la présentation

Two-Dimensional Viewing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Two-Dimensional Viewing 6

  2. Contents • Window and Viewport • The Viewing Transformation • Window-to-Viewport coordinate transformation • Point clipping • Line clipping • Polygon clipping • Exterior clipping

  3. Window and Viewport • Window • A world-coordinate area selected for display • What is to be viewed • Viewport • An area on a display device to which a window is mapped • Where is to be displayed World Coordinates Device Coordinates

  4. Window and Viewport (계속) • Window to Viewport Mapping

  5. Window and Viewport (계속)

  6. The Viewing Transformation • Viewing transformation • window-to-viewport transformation, windowing transformation construct world coordinates convert to viewing coordinates map to normalized viewing coordinates viewport clipping World Coordinates Normalized Device Coordinates map to device coordinates

  7. Viewing coordinatereference frame • World 좌표  View좌표 1. 중심 이동 2. 회전 MWC,VC = R•T 두 좌축의 축을 맞추는회전 뷰좌표 중심을 전체좌표 중심으로 이동

  8. Window-to-ViewportCoordinate Transformation • 윈도우의 점을 뷰포트로 변경 • 상대 거리를 유지하게 함 , 1. Scaling the window to the size of the viewport 2. Translate to the position of the viewport Window to Viewport Transformation

  9. Workstation transformation • Normalized coordinates에서 다양한 device로 매핑 • 각 device마다 window-to-viewport transformation 수행 • 하나의 뷰의 다른 부분을 각 장치에서 볼 수 있음

  10. Clipping • Clipping • 그림의 일부가 정해진 영역 내부인지 외부인지 구별 • 전체좌표계에 적용 • Point clipping • 다음을 만족하는 점 P=(x,y) 저장 • 응용 : 폭발, 바다등 particle model의 화면처리

  11. Line Clipping After Clipping Before Clipping 1. Check all segments Intersect the window boundary 2. Clip line segments Calculate the intersections with the window boundary

  12. Cohen-Sutherland Line Clipping • Basic idea • Encode the line endpoints • Successively divide the line segments so that they are completely contained in the window or completely lies out side window • Division occurs at the boundary of window

  13. Cohen-Sutherland Line Clipping • 2진 영역 코드(region code) • 4bits : 왼쪽, 오른쪽, 아래, 위 • clipping 사각형에 대한 위치 의미 • 0000 : clipping 사각형 내의 점 • 선의 구분 • Visible : 선의 양 끝점의 code가 모두 0000 • Invisible : 양 끝점 code의 Logical AND 가 0000이 아닐 때 • Indeterminate : Logical AND는 0000이지만, 끝점의 code가 0000이 아닌 경우 이 경우에 대해 Clipping실시 A B 선 끝점에 대한 2진 영역코드

  14. Cohen-Sutherland Line Clipping P2 • 경계와의 교차점 찾기 • (예) • P1에서 P2로 지나는 선분 • 아래 끝점 P1의 좌, 우, 하방에 대한 경계비교 • 창의 아래쪽이므로 창 아래 경계 교차점 P1’찾음 • P1에서 P1’버림 • 상단 : P2 --> P2‘--> P2“순으로 찾아 나감 • P3에서 P4로 지나는 선분 • P3는 창 왼쪽이므로 P3’찾아 선분 P3에서 P3’은 버림 • 선분 P3’에서 P4는 창 아래이므로 버림 P’2 P”2 P3 P’1 P1 P’3 P4 절단 창을 지나는 두 선분

  15. Cohen-Sutherland Line Clipping Quiz) B A (8,8) D Line AB : A(3,10), B(6,12) CD : C(4,1), D(10,6) (2,2) C

  16. B A (8,8) D (2,2) C Cohen-Sutherland Line Clipping Step1. Encode end points AB A(3,10) 1000 B(6,12) 1000 Logical AND 1000 CD C( 4, 1) 0100 D(10,6) 0010 Logical AND 0000 Invisible Indeterminate Step2. Clip line CD

  17. Midpoint Subdivision • Similar to Cohen-Sutherland Algorithm except dividing strategy • Division occurres at midpoints!! Pm Window Pm Pm

  18. Midpoint Subdivision Ex) Window : (2,2),(8,6) Line AB : A(4,3), B(10,5) Sub Divisions Mid Points Segment Further Chosen Division A 0000 B 0010 Logical AND 0000 1 (7,4) (7,4) ~ (10,5) 2 3 4 . . Indeterminate

  19. Polygon Clipping • Line clipper 이용, 몇 개의 닫힌 다각형들 생성 • Window boundary를 따라가며 Clipping 수행 Before Clipping After Clipping

  20. Polygon Clipping (계속) • Sutherland-Hodgeman Clipping • 다각형 정점 처리방법 - 시계방향으로 edge 탐색 • 처리된 정점을 다음 면에 반복 적용 • Concave polygon에는 부적합 (d) (c) (a) (b)

  21. Polygon Clipping (계속) • Weiler-Atherton Polygon Clipping • Concave Polygon에도 적용가능 하도록 Clipping에 Polygon edge 뿐 아니라 Window boundary도 사용 • 탐색원리(시계 방향의 경우) • 바깥쪽  안쪽 : 다각형의 경계 따름 • 안쪽  바깥쪽 : 창의 경계 따라 탐색 • 응용 : Weiler Polygon Clipping • 임의의 다각형의 경계 처리 Weiler-atherton polygon clipping 을 적용하여 두개 영역 생성 Weiler polygon clipping

  22. Exterior Clipping • Exterior Clipping • 영역의 바깥쪽을 저장 • 적용 예 • Multiple window system • 그림에 라벨이나 디자인 패턴 입력 • 안쪽 절단에 응용 Interior clipping과 exterior clipping을 이용한 polygon 내부 line clipping

More Related