This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Graphics (Output) Primitives Chapters 3 & 4 Graphic Output and Input Graphic Output and Input Pipeline Pipeline n Scan conversion n converts primitives such as lines, circles, etc. into pixel values n geometric description Þ a finite scene area n Clipping n the process of determining the portion of a primitive lying within a region called clip region Graphic Output Pipeline Graphic Output Pipeline application model : descriptions of objects application program : generates a sequence of functions to display a model graphics package : clipping, scan conversion, shading, etc. display H/W Graphic Input Pipeline Graphic Input Pipeline user interaction (e.g., mouse click) graphic package (by sampling or eventdriven input functions) application program modify the model or the image on the screen Output Pipeline in Software Output Pipeline in Software When scan conversion and clipping happen? n Clipping before scan conversion n for lines, rectangles, and polygons clipping before scan converting each primitive (scissoring) n Clipping after scan converting the entire collection of primitives into a temporary canvas n for text Scan Converting Lines Scan Converting Lines A line from (x 1 ,y 1 ) to (x 2 ,y 2 ) Þ a series of pixels [Criteria] n Straight lines should appear straight n Line endpoints should be constrained n Uniform density and intensity n Line algorithms should be fast Why Study Why Study Scan Conversion Algorithms? Scan Conversion Algorithms? § Every highend graphics card support this. § You will never have to write these routines yourself, unless you become a graphics hardware designer. § So why learn this stuff? § Maybe you will become a graphics hardware designer. § But seriously, the same basic tricks underlie lots of algorithms: § 3D shaded polygons § Texture mapping § etc. Simple Scan Converting Lines Simple Scan Converting Lines Based on slopeintercept algorithm from algebra: y = mx + b Simple approach: increment x , solve for y Floating point arithmetic required Digital Differential Analyzer(DDA) Digital Differential Analyzer(DDA) n Idea 1. Go to starting end point 2. Increment x and y values by constants proportional to x and y such that one of them is 1. If 0 <m £ 1 , y k+1 = y k + m If m >1 , x k+1 = x k + 1/ m 3. Round to the closest raster position ) , ( i i y x )) ( , 1 ( m y Round x i i + + )) ( , ( i i y Round x ) , 1 ( m y x i i + + Digital Differential Analyzer(DDA) Digital Differential Analyzer(DDA) n Drawbacks n rounding to an integer takes time n floatingpoint operations n Is there a simpler way? n Can we use only integer arithmetic? Easier to implement in hardware Midpoint Line Algorithm Midpoint Line Algorithm (Bresenham's Bresenham's Line Algorithm) Line Algorithm) n Assume a line from ( x 1 , y 1 ) to ( x 2 , y 2 ) that 0< m < 1 and x 1 < x 2 ....
View
Full Document
 Fall '08
 Shinyeonggil
 Computer Graphics, Bresenham's line algorithm, scan line, midpoint line algorithm, yk dupper

Click to edit the document details