1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Lecture computer graphics and virtual reality slides lesson 4 fundamental algorithms

61 0 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Fundamental Algorithms
Tác giả Trinh Thanh Trung
Trường học Hust
Chuyên ngành Ict
Thể loại Lecture Slides
Định dạng
Số trang 61
Dung lượng 1,51 MB

Nội dung

Trang 4 Clipping■ A fundamental task in graphics is to keep those parts of an object that lie outside a selected view from being drawn Trang 6 Line clipping■ Lines are defined by their

Lesson Fundamental algorithms Trinh Thanh Trung School of ICT, HUST Content Clipping algorithms Polygon drawing Anti-aliasing Clipping algorithms Clipping ■ A fundamental task in graphics is to keep those parts of an object that lie outside a selected view from being drawn ■ Clipping is the removal of all objects or part of objects in a modelled scene that are outside the real-world window Clipping ■ For each point to be rendered on the screen xmin  x  xmax ymin  y  ymax xmin xmax ymax ymin Line clipping ■ Lines are defined by their endpoints, so it should be possible just to examine these (in a similar way to points) and determine whether or not to clip without considering every pixel on the line ■ We often have windows that are either very large, i.e nearly the whole scene fits inside, or very small, i.e most of the scene lies inside the window ■ Hence, most lines may be either trivially accepted or rejected Cohen-Sutherland Outcode Line clipping Cohen-Sutherland Outcode ■ Each point on all lines are first assigned an “outcode” defining their position relative to the clipping rectangle ■ If p.x = ymax: P.code or 1000 Cohen-Sutherland Outcode ■ If P1.code OR P2.code == 0000 □ Accept line ■ If P1.code AND P2.code != 0000 □ Remove line ■ In case the line crosses the screen, the end points will be redefined by the intersections of the line and the boundary of the display Cohen-Sutherland ■ The Cohen-Sutherland line-clipping algorithm is particularly fast for “trivial” cases, i.e lines completely inside or outside the window ■ Non-trivial lines, i.e ones that cross a boundary of the window, are clipped by computing the coordinates of the new boundary endpoint of the line where it crosses the edge of the window

Ngày đăng: 02/03/2024, 13:59

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN