This chapter explain why computer literacy is vital to success in today''s world, describe the five components of a computer, discuss the advantages and disadvantages that users experience when working with computers, discuss the uses of the Internet and World Wide Web,...
Trang 1Computer Graphics
Lecture 21 Fasih ur Rehman
Trang 2Last Class
• Clipping Algorithms
Trang 3Today’s Agenda
• Clipping Algorithms
Trang 4Cohen – Sutherland Line
Clipping
Trang 5Cohen – Sutherland Line
Clipping
• The view window is divided into regions as shown in the figure
• Each region is assigned a 4-bit outcode
Trang 6Cohen – Sutherland Line
Clipping
• Most significant bit (MSB) called bit 1 indicates y-value of points are above ymax
• Bit 2 indicates y-value of points are below ymin
• Bit 3 indicates x-value of points are to the right of Xmax
• Bit 4 indicates x-value of points are to the left of Xmin
Trang 7Cohen – Sutherland Line
Clipping
• For each line segment
operation)
• trivial accept (Line AB of the Figure)
– Else
• AND (bitwise) vertex outcodes
• if result 0, trivial reject (e g EF)
Trang 8Cohen – Sutherland Line
Clipping
• If line cannot be trivially accepted or
rejected, subdivide the line into the
segments either or both of which can be
rejected
intersects
(outside the view window) and assign new
outcode to new vertex
Trang 9Cohen – Sutherland Line
Clipping
rejected, subdivide the line so that o both or either
of the two segments can be discarded
Trang 10To find intersection point
Trang 11Parametric Form of Line
Trang 12• Clipping
Trang 13• Fundamentals of Computer Graphics Third Edition by Peter Shirley and Steve
Marschner
• Interactive Computer Graphics, A
Top-down Approach with OpenGL (Sixth
Edition) by Edward Angel