C O M P U T E R G R A P H I C S Guoying Zhao 1 / 50 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 45 Computer Graphics Implementation I.

Slides:



Advertisements
Similar presentations
Graphics Primitives: line
Advertisements

Section 3-1 to 3-2, 3-5 Drawing Lines Some of the material in these slides may have been adapted from university of Virginia, MIT, and Åbo Akademi University.
CS 376 Introduction to Computer Graphics 02 / 02 / 2007 Instructor: Michael Eckmann.
Computer Graphics 4: Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling By:Kanwarjeet Singh.
1 King ABDUL AZIZ University Faculty Of Computing and Information Technology CS 454 Computer graphics Drawing Elementary Figures Dr. Eng. Farag Elnagahy.
CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE.
+ CPCS 391 Computer Graphics 1 Instructor: Dr. Sahar Shabanah Lecture 3.
Line Drawing Algorithms. Rasterization-Process of determining which pixels give the best approximation to a desired line on the screen. Scan Conversion-Digitizing.
The lines of this object appear continuous However, they are made of pixels 2April 13, 2015.
Komputer Grafik 2 (AK045206) Scan Conversion 1/31 Scan Conversion.
2D Output Primitives Graphics packages provide basic operations (called primitive operations) to describe a scene in terms of geometric structures. The.
Implementation III Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Line Drawing by Algorithm. Line Drawing Algorithms Line drawn as pixels Graphics system –Projects the endpoints to their pixel locations in the frame.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Scan Conversion CS123 1 of 44Scan Conversion - 10/14/2014.
Rasterization Foley, Ch: 3. Pixels are represented as disjoint circles centered on uniform grid Each (x,y) of the grid has a pixel Y X (1,1) (1,2) (0,0)
CS 450: COMPUTER GRAPHICS DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE.
1 Preliminaries Precalculus Review I Precalculus Review II
Rasterizing primitives: know where to draw the line Dr Nicolas Holzschuch University of Cape Town Modified.
Dr. Scott Schaefer Scan Conversion of Lines. 2/78 Displays – Cathode Ray Tube.
1/1/20001 Topic >>>> Scan Conversion CSE Computer Graphics.
Dr. S.M. Malaek Assistant: M. Younesi
Jehee Lee Seoul National University
Graphics Primitives: line. Pixel Position
WHERE TO DRAW A LINE?? Line drawing is accomplished by calculating intermediate positions along the line path between specified end points. Precise definition.
Scan Conversion Line and Circle
Informationsteknologi Monday, November 26, 2007Computer Graphics - Class 121 Today’s class Drawing lines Bresenham’s algorithm Compositing Polygon filling.
Triangle Scan Conversion. 2 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Rasterization Rasterization (scan conversion) –Determine which.
CS 325 Introduction to Computer Graphics 02 / 01 / 2010 Instructor: Michael Eckmann.
1Computer Graphics Implementation III Lecture 17 John Shearer Culture Lab – space 2
Introduction to Computer Graphics with WebGL
CS 480/680 Computer Graphics Implementation III Dr. Frederick C Harris, Jr. Fall 2011.
Introduction Computer Graphics & Its application Types of computer graphics Graphic display : random Scan & Raster Scan display Frame buffer and video.
Graphics Output Primitives
CGMB214: Introduction to Computer Graphics
 A line segment in a scene is defined by the coordinate positions of the line end-points x y (2, 2) (7, 5)
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Computer Graphics Drawing Line. Lines and Polylines Convex: For every pair of points in the polygon, the line between them is fully contained in the polygon.
10/15/02 (c) 2002 University of Wisconsin, CS559 Who Am I? Prof Stephen Chenney These notes will be online after the lecture – in fact they’re online already.
Midpoint Circle Algorithm
CS 325 Introduction to Computer Graphics 02 / 03 / 2010 Instructor: Michael Eckmann.
1 CSCE 441 Lecture 2: Scan Conversion of Lines Jinxiang Chai.
GEOMETRY AND LINE GENERATION Geometry and Line Generation Chapter 2.
Scan Conversion.
Lecture 2: 19/4/1435 Graphical algorithms Lecturer/ Kawther Abas CS- 375 Graphics and Human Computer Interaction.
Rasterization Overview Raster Display Device. Scan Conversion / Rasterization: converting vector graphics into raster graphics (determining pixels in.
Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
Write Bresenham’s algorithm for generation of line also indicate which raster locations would be chosen by Bresenham’s algorithm when scan converting.
10/10/2006TCSS458A Isabelle Bichindaritz1 Line and Circle Drawing Algorithms.
Computer Graphics Lecture 07 Ellipse and Other Curves Taqdees A. Siddiqi
Computer Graphics I, Fall 2010 Scan conversion algorithms.
Rasterization, or “What is glBegin(GL_LINES) really doing?” Course web page: February 23, 2012  Lecture 4.
Line Drawing Algorithms 1. A line in Computer graphics is a portion of straight line that extends indefinitely in opposite direction. 2. It is defined.
Primitive graphic objects
Scan Conversion or Rasterization
Computer Graphics Drawing Line.
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1
Scan Conversion or Rasterization
University of New Mexico
Implementation III.
Computer Graphics Implementation I.
Introduction to Computer Graphics with WebGL
CSCE 441 Lecture 2: Scan Conversion of Lines
Rasterization and Antialiasing
Computer Graphics Implementation III
Rasterization and Antialiasing
Edited from The Rasterization Problem: Idealized Primitives Map to Discrete Display Space Edited from.
Chapter 3 Graphics Output Primitives
Implementation III Ed Angel Professor Emeritus of Computer Science
Line Drawing Algorithms
Presentation transcript:

C O M P U T E R G R A P H I C S Guoying Zhao 1 / 50 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 45 Computer Graphics Implementation I

C O M P U T E R G R A P H I C S Guoying Zhao 2 / 50 C O M P U T E R G R A P H I C S Guoying Zhao 2 / 45 Algorithms for Drawing 2D Primitives Line Drawing Algorithms –DDA algorithm –Midpoint algorithm –Bresenham’s line algorithm Circle Generating Algorithms –Bresenham’s circle algorithm –Extension to Ellipse drawing

C O M P U T E R G R A P H I C S Guoying Zhao 3 / 50 Line Drawing

C O M P U T E R G R A P H I C S Guoying Zhao 4 / 50 Line Drawing Draw a line on a raster screen between two points What’s wrong with statement of problem? –doesn’t say anything about which points are allowed as endpoints –doesn’t give a clear meaning of “draw” –doesn’t say what constitutes a “line” in raster world –doesn’t say how to measure success of proposed algorithms Problem Statement Given two points P and Q in XY plane, both with integer coordinates, determine which pixels on raster screen should be on in order to make picture of a unit-width line segment starting at P and ending at Q Scan Converting Lines

C O M P U T E R G R A P H I C S Guoying Zhao 5 / 50 Special case: Horizontal Line: Draw pixel P and increment x coordinate value by 1 to get next pixel. Vertical Line: Draw pixel P and increment y coordinate value by 1 to get next pixel. Diagonal Line: Draw pixel P and increment both x and y coordinate by 1 to get next pixel. What should we do in general case? => Fast - Digital differential analyzer (DDA) algorithm - Mid-point algorithm - Bresenham algorithm Finding next pixel:

C O M P U T E R G R A P H I C S Guoying Zhao 6 / 50 C O M P U T E R G R A P H I C S Guoying Zhao 6 / 45 6 Scan Conversion of Line Segments Start with line segment in window coordinates with integer values for endpoints Assume implementation has a write_pixel function y = mx + h

C O M P U T E R G R A P H I C S Guoying Zhao 7 / 50 Basic Algorithm Find equation of line that connects two points P(x1,y1) and Q(x2,y2) Starting with leftmost point P, increment x i by 1 to calculate y i = m*x i + h where m = slope, h = y intercept Draw pixel at (x i, Round(y i )) where Round (y i ) = Floor (0.5 + y i )

C O M P U T E R G R A P H I C S Guoying Zhao 8 / 50 C O M P U T E R G R A P H I C S Guoying Zhao 8 / 45 8 Strategy 1 – DDA Algorithm Digital Differential Analyzer –DDA was a mechanical device for numerical solution of differential equations –Line y=mx+ h satisfies differential equation dy/dx = m =  y/  x = (y 2 -y 1 )/(x 2 -x 1 ) Along scan line  x = 1 For(x=x1; x<=x2,x++) { y+=m; write_pixel(x, round(y), line_color) }

C O M P U T E R G R A P H I C S Guoying Zhao 9 / 50 Example Code // Incremental Line Algorithm // Assume x0 < x1 void Line(int x0, int y0, int x1, int y1) { intx, y; floatdy = y1 – y0; floatdx = x1 – x0; floatm = dy / dx; y = y0; for (x = x0; x < x1; x++) { WritePixel(x, Round(y)); y = y + m; }

C O M P U T E R G R A P H I C S Guoying Zhao 10 / 50

C O M P U T E R G R A P H I C S Guoying Zhao 11 / 50 C O M P U T E R G R A P H I C S Guoying Zhao 11 / Problem DDA = for each x plot pixel at closest y –Problems for steep lines

C O M P U T E R G R A P H I C S Guoying Zhao 12 / 50 C O M P U T E R G R A P H I C S Guoying Zhao 12 / Using Symmetry Use for 1  m  0 For m > 1, swap role of x and y –For each y, plot closest x

C O M P U T E R G R A P H I C S Guoying Zhao 13 / 50 Problem void Line(int x0, int y0, int x1, int y1) { intx, y; floatdy = y1 – y0; floatdx = x1 – x0; floatm = dy / dx; y = y0; for (x = x0; x < x1; x++) { WritePixel(x, Round(y)); y = y + m; } Rounding takes time

C O M P U T E R G R A P H I C S Guoying Zhao 14 / 50 Assume that line’s slope is shallow and positive (0 < slope < 1); other slopes can be handled by suitable reflections about principle axes Call lower left endpoint (x 0, y 0 ) and upper right endpoint (x 1, y 1 ) Assume that we have just selected pixel P at (x p, y p ) Next, we must choose between pixel to right (E pixel) (x p +1, y p ), or one right and one up (NE pixel) (x p +1, y p +1) Let Q be intersection point of line being scan-converted and vertical line x=x p +1 Strategy 2 – Midpoint Line Algorithm (1/3)

C O M P U T E R G R A P H I C S Guoying Zhao 15 / 50 Strategy 2 – Midpoint Line Algorithm (2/3) Previous pixelChoices for current pixel Choices for next pixel E pixel NE pixel Midpoint M Q

C O M P U T E R G R A P H I C S Guoying Zhao 16 / 50 Line passes between E and NE Point that is closer to intersection point Q must be chosen Observe on which side of line midpoint M lies: –E is closer to line if midpoint M lies above line, i.e., line crosses bottom half –NE is closer to line if midpoint M lies below line, i.e., line crosses top half Error (vertical distance between chosen pixel and actual line) is always <= ½ Strategy 2 – Midpoint Line Algorithm (3/3) Algorithm chooses NE as next pixel for line shown Now, need to find a way to calculate on which side of line midpoint lies E pixel NE pixel M Q

C O M P U T E R G R A P H I C S Guoying Zhao 17 / 50 Line equation as function f(x): Line equation as implicit function: for coefficients a, b, c, where a, b ≠ 0 from above, Properties (proof by case analysis): f(x m, y m ) = 0 when any point M is on line f(x m, y m ) < 0 when any point M is above line f(x m, y m ) > 0 when any point M is below line Our decision will be based on value of function at midpoint M at (x p + 1, y p + ½) Line

C O M P U T E R G R A P H I C S Guoying Zhao 18 / 50 void MidpointLine(int x0, int y0, int x1, int y1) { intdx = x1 - x0; intdy = y1 - y0; intx = x0; inty = y0; float c = y0 * dx – dy * x0; writePixel(x, y); x++; while (x < x1) { d = dy * x – (y + 0.5) * dx + c; if (d > 0) { // Northeast Case y++; } writePixel(x, y); x++; }/* while */ }

C O M P U T E R G R A P H I C S Guoying Zhao 19 / 50 Decision Variable d: We only need sign of f(x p + 1, y p + ½) to see where line lies, and then pick nearest pixel d = f(x p + 1, y p + ½) - if d > 0 choose pixel NE - if d < 0 choose pixel E - if d = 0 choose either one consistently How do we incrementally update d? On basis of picking E or NE, figure out location of M for that pixel, and corresponding value d for next grid line We can derive d for the next pixel based on our current decision Decision Variable

C O M P U T E R G R A P H I C S Guoying Zhao 20 / 50 Increment M by one in x direction d new = f(x p + 2, y p + ½) = a(x p + 2) + b(y p + ½) + c d old = a(x p + 1) + b(y p + ½) + c d new - d old is the incremental difference  E d new = d old + a  E = a = dy We can compute value of decision variable at next step incrementally without computing F(M) directly d new = d old +  E = d old + dy  E can be thought of as correction or update factor to take d old to d new It is referred to as forward difference If E was chosen: Strategy 3 – Bresenham algorithm

C O M P U T E R G R A P H I C S Guoying Zhao 21 / 50 Increment M by one in both x and y directions d new = F(x p + 2, y p + 3/2) = a(x p + 2) + b(y p + 3/2) + c  NE = d new – d old d new = d old + a + b  NE = a + b = dy – dx Thus, incrementally, d new = d old +  NE = d old + dy – dx If NE was chosen:

C O M P U T E R G R A P H I C S Guoying Zhao 22 / 50 At each step, algorithm chooses between 2 pixels based on sign of decision variable calculated in previous iteration. It then updates decision variable by adding either  E or  NE to old value depending on choice of pixel. Simple additions only! First pixel is first endpoint (x 0, y 0 ), so we can directly calculate initial value of d for choosing between E and NE. Summary (1/2)

C O M P U T E R G R A P H I C S Guoying Zhao 23 / 50 First midpoint for first d = d start is at (x 0 + 1, y 0 + ½) f(x 0 + 1, y 0 + ½) = a(x 0 + 1) + b(y 0 + ½) + c = a * x 0 + b * y 0 + c + a + b/2 = f(x 0, y 0 ) + a + b/2 But (x 0, y 0 ) is point on line and f(x 0, y 0 ) = 0 Therefore, d start = a + b/2 = dy – dx/2 –use d start to choose second pixel, etc. To eliminate fraction in d start : –redefine f by multiplying it by 2; f(x,y) = 2(ax + by + c) –this multiplies each constant and decision variable by 2, but does not change sign Summary (2/2)

C O M P U T E R G R A P H I C S Guoying Zhao 24 / 50 Example Code void Bresenham (int x0, int y0, int x1, int y1) { intdx = x1 - x0; intdy = y1 - y0; intd = 2 * dy - dx; intincrE = 2 * dy; intincrNE = 2 * (dy - dx); intx = x0; inty = y0; writePixel(x, y); while (x < x1) { if (d <= 0) {// East Case d = d + incrE; } else {// Northeast Case d = d + incrNE; y++; } x++; writePixel(x, y); }/* while */ }/* MidpointLine */

C O M P U T E R G R A P H I C S Guoying Zhao 25 / 50 Drawing Circles

C O M P U T E R G R A P H I C S Guoying Zhao 26 / 50 C O M P U T E R G R A P H I C S Guoying Zhao 26 / 45 Bresenham’s Circle Algorithm Circle Equation –(x-x c ) 2 + (y- y c ) 2 = R 2 Problem simplifying –Making the circle origin (x c, y c ) in the coordinate origin –Symmetry points (y,x), (y,-x),(x,-y),(-x,- y),(-y,-x),(-y,x),(-x,y)

C O M P U T E R G R A P H I C S Guoying Zhao 27 / 50 Version 1: really bad For x = – R to R y = sqrt(R * R – x * x); Pixel (round(x), round(y)); Pixel (round(x), round(-y)); Version 2: slightly less bad For x = 0 to 360 Pixel (round (R cos(x)), round(R sin(x))); (17, 0) (0, 17) (17, 0) (0, 17) Scan Converting Circles

C O M P U T E R G R A P H I C S Guoying Zhao 28 / 50 Suppose circle origin is (x c,y c ), radius is R. Let D(x, y) = (x-x c ) 2 +(y-y c ) 2 –R 2 If point(x,y) is outside the circle, D(x,y)>0 。 If point(x,y) is inside the circle, D(x,y)<0 。 (x c, y c )

C O M P U T E R G R A P H I C S Guoying Zhao 29 / 50 Bresenham’s Circle Algorithm Two choice: (x i +1, y i ) or (x i +1, y i -1) (x i, y i )(x i +1, y i ) (x i +1, y i -1) (x i, y i -1) (x i +1, y i ) (x i +1, y i -1) (x i, y i ) (x i, y i -1)

C O M P U T E R G R A P H I C S Guoying Zhao 30 / 50 Symmetry: If (x 0 + a, y 0 + b) is on circle –also (x 0 ± a, y 0 ± b) and (x 0 ± b, y 0 ± a); hence 8-way symmetry. Reduce the problem to finding the pixels for 1/8 of the circle R (x 0 + a, y 0 + b) (x-x 0 ) 2 + (y-y 0 ) 2 = R 2 (x 0, y 0 ) Use Symmetry

C O M P U T E R G R A P H I C S Guoying Zhao 31 / 50 Scan top right 1/8 of circle of radius R Circle starts at (x 0, y 0 + R) Let’s use another incremental algorithm with decision variable evaluated at midpoint (x 0, y 0 ) Using the Symmetry

C O M P U T E R G R A P H I C S Guoying Zhao 32 / 50 E SESE x = x 0 ; y = y 0 + R; Pixel(x, y); for (x = x 0 +1; (x – x 0 ) < (y – y 0 ); x++) { if (decision_var < 0) { /* move east */ update decision_var; } else { /* move south east */ update decision_var; y--; } Pixel(x, y); } Sketch of Incremental Algorithm

C O M P U T E R G R A P H I C S Guoying Zhao 33 / 50 Decision variable –negative if we move E, positive if we move SE (or vice versa). Follow line strategy: Use implicit equation of circle f(x,y) = x 2 + y 2 – R 2 = 0 f(x,y) is zero on circle, negative inside, positive outside If we are at pixel (x, y) – examine (x + 1, y) and (x + 1, y – 1) Compute f at the midpoint What we need for Incremental Algorithm

C O M P U T E R G R A P H I C S Guoying Zhao 34 / 50 P = (x p, y p ) MMEME M SE SE Decision Variable E Evaluate f(x,y) = x 2 + y 2 – R 2 at the point We are asking: “Is positive or negative?” (it is zero on circle) If negative, midpoint inside circle, choose E –vertical distance to the circle is less at (x + 1, y) than at (x + 1, y–1). If positive, opposite is true, choose SE )1( 2 1,1Ryxyxf                       2 1,1yx

C O M P U T E R G R A P H I C S Guoying Zhao 35 / 50 Decision based on vertical distance Ok for lines, since d and d vert are proportional For circles, not true: Which d is closer to zero? (i.e. which of the two values below is closer to R): RyxCircyxd Ryx yxd   )1()1()),1,1(( )1()),,1(( 2222 )1()1()1(  yxoryx The right decision variable?

C O M P U T E R G R A P H I C S Guoying Zhao 36 / 50 We could ask instead: “Is (x + 1) 2 + y 2 or (x + 1) 2 + (y – 1) 2 closer to R 2 ?” The two values in equation above differ by 12])1()1[(])  yyxyx f E – f SE = 290 – 257 = 33 (0, 17) (1, 17) (1, 16) f E = = 290 E SE f SE = = 257 2y – 1 = 2(17) – 1 = 33 Alternate Phrasing (1/3)

C O M P U T E R G R A P H I C S Guoying Zhao 37 / 50 The second value, which is always less, is closer if its difference from R 2 is less than i.e., if then so  2 )12( 1  y ])1()1[( 222  yx R )12( 2 1        y 2 1 )1(0 222 Ryyx  )1(0 222 Ryyyx  )1()1( Ryxy  )1(0Ryx         Alternate Phrasing (2/3)

C O M P U T E R G R A P H I C S Guoying Zhao 38 / 50 The radial distance decision is whether is positive or negative And the vertical distance decision is whether is positive or negative; d1 and d2 are apart. The integer d1 is positive only if d2 + is positive (except special case where d2 = 0) )1(1Ryxd         )1(2Ryxd         Alternate Phrasing (3/3)

C O M P U T E R G R A P H I C S Guoying Zhao 39 / 50 How to compute the value of at successive points? Answer: Note that is just and that is just (1/2) )1(),(Ryxyxf         2232),( ),()1,1( 32),( ),(),1( SE E     yxyx yxfyxf xyx yxfyxf Incremental Computation, Again

C O M P U T E R G R A P H I C S Guoying Zhao 40 / 50 F F’ F’’ Incremental Computation (2/2) If we move E, update by adding 2x + 3 If we move SE, update by adding 2x + 3 – 2y + 2. Forward differences of a 1 st degree polynomial are constants and those of a 2 nd degree polynomial are 1 st degree polynomials –this “first order forward difference,” like a partial derivative, is one degree lower

C O M P U T E R G R A P H I C S Guoying Zhao 41 / 50 The function is linear, hence amenable to incremental computation, viz: Similarly Second Differences (1/2) 32),( E  xyx 2),()1,1( EE  yxyx2),(),1( EE  yxyx 4),()1,1( SE  yxyx2),(),1(  yxyx

C O M P U T E R G R A P H I C S Guoying Zhao 42 / 50 For any step, can compute new Δ E (x, y) from old Δ E (x, y) by adding appropriate second constant increment – update delta terms as we move. –This is also true of Δ SE (x, y) Having drawn pixel (a,b), decide location of new pixel at (a + 1, b) or (a + 1, b – 1), using previously computed d(a, b). Having drawn new pixel, must update d(a, b) for next iteration; need to find either d(a + 1, b) or d(a + 1, b – 1) depending on pixel choice Must add Δ E (a, b) or Δ SE (a, b) to d(a, b) So we… –Look at d(i) to decide which to draw next, update x and y –Update d using Δ E (a,b) or Δ SE (a,b) –Update each of Δ E (a,b) and Δ SE (a,b) for future use –Draw pixel Second Differences (2/2)

C O M P U T E R G R A P H I C S Guoying Zhao 43 / 50 Bresenham’s Eighth Circle Algorithm MEC (R) /* 1/8 th of a circle w/ radius R */ {int x = 0, y = R; int delta_E, delta_SE; float decision; delta_E = 2*x + 3; delta_SE = 2(x-y) + 5; decision = (x+1)*(x+1) + (y - 0.5)*(y - 0.5) –R*R; Pixel(x, y); while( y > x ) { if (decision < 0) {/* Move east */ decision += delta_E; delta_E += 2; delta_SE += 2; /*Update delta*/ } else {/* Move SE */ y--; decision += delta_SE; delta_E += 2; delta_SE += 4; /*Update delta*/} x++; Pixel(x, y); } }

C O M P U T E R G R A P H I C S Guoying Zhao 44 / 50 Uses floats! 1 test, 3 or 4 additions per pixel Initialization can be improved Multiply everything by 4 No Floats! –Makes the components even, but sign of decision variable remains same Questions Are we getting all pixels whose distance from the circle is less than ½? Why is y > x the right stopping criterion? What if it were an ellipse? Analysis

C O M P U T E R G R A P H I C S Guoying Zhao 45 / 50 Equation is i.e, Computation of and is similar Only 4-fold symmetry When do we stop stepping horizontally and switch to vertical? Aligned Ellipses  b y a x bayaxb  E  SE 

C O M P U T E R G R A P H I C S Guoying Zhao 46 / 50 When absolute value of slope of ellipse is more than 1, viz: How do you check this? At a point (x,y) for which f(x,y) = 0, a vector perpendicular to the level set is f(x,y) which is This vector points more right than up when Direction Changing Criterion (1/2)           ),(),,(yx y f yx x f 0),(),(       yx y f yx x f 

C O M P U T E R G R A P H I C S Guoying Zhao 47 / 50 In our case, and so we check for i.e. This, too, can be computed incrementally Direction Changing Criterion (2/2) xayx x f 2 2),(    ybyx y f 2 2),(     ybxa0 22  ybxa

C O M P U T E R G R A P H I C S Guoying Zhao 48 / 50 Patterned primitives Non-integer primitives General conics Other Scan Conversion Problems

C O M P U T E R G R A P H I C S Guoying Zhao 49 / 50 Patterned line from P to Q is not same as patterned line from Q to P. Patterns can be geometric or cosmetic –Cosmetic: Texture applied after transformations –Geometric: Pattern subject to transformations Cosmetic patterned line Geometric patterned line Patterned Lines P Q P Q

C O M P U T E R G R A P H I C S Guoying Zhao 50 / 50 Geometric Pattern vs. Cosmetic Pattern + Geometric (Perspectivized/Filtered)Cosmetic