Primitive Drawing Algorithm

Slides:



Advertisements
Similar presentations
Graphics Primitives Part II: Bresenhams line and circle.
Advertisements

Computer Graphics- SCC 342
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1 Emmanuel Agu.
Computer Graphics 4: Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling By:Kanwarjeet Singh.
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.
CS 450: COMPUTER GRAPHICS FILLING POLYGONS SPRING 2015 DR. MICHAEL J. REALE.
Informationsteknologi Monday, October 29, 2007Computer Graphics - Class 21 Today’s class Graphics programming Color.
CS 376 Introduction to Computer Graphics 02 / 05 / 2007 Instructor: Michael Eckmann.
Output Primitives Computer Graphics.
CMPE 466 COMPUTER GRAPHICS
Implementation III Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Graphics Output Primitives Pixel Addressing and Fill Area Dr. M. Al-Mulhem Feb. 1, 2008.
CS 4731: Computer Graphics Lecture 22: Raster Graphics Part 3 Emmanuel Agu.
Line Drawing by Algorithm. Line Drawing Algorithms Line drawn as pixels Graphics system –Projects the endpoints to their pixel locations in the frame.
Computer Graphics, KKU. Lecture 9
Circle Drawing algo..
March Shape Drawing Algorithms Shmuel Wimer Bar Ilan Univ., Engineering Faculty.
CGMB 314 Intro to Computer Graphics Fill Area Primitives.
Geometric Objects Computer Graphics Lab. Sun-Jeong Kim.
CGMB214: Introduction to Computer Graphics
Dr. S.M. Malaek Assistant: M. Younesi
Graphics Graphics Korea University cgvr.korea.ac.kr Raster Graphics 고려대학교 컴퓨터 그래픽스 연구실.
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
Graphics Graphics Korea University cgvr.korea.ac.kr Raster Graphics 고려대학교 컴퓨터 그래픽스 연구실.
CS 325 Introduction to Computer Graphics 02 / 01 / 2010 Instructor: Michael Eckmann.
Introduction to Computer Graphics with WebGL
CS 480/680 Computer Graphics Implementation III Dr. Frederick C Harris, Jr. Fall 2011.
Graphics Output Primitives
Line Drawing and Generalization. Outline  overview  line drawing  circle drawing  curve drawing.
CGMB214: Introduction to Computer Graphics
2D Output Primitives Points Lines Circles Ellipses Other curves Filling areas Text Patterns Polymarkers.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Attributes of Graphics Primitives Hearn & Baker Chapter 4 Some slides are taken from Robert Thomsons notes.
GEOMETRY AND LINE GENERATION Geometry and Line Generation Chapter 2.
In the name of God Computer Graphics. Today Introduction Sampling Graphic Output Primitives 1.Line 2.Circle 3.Curve 4.polygon.
2D Output Primitives Points Lines Circles Ellipses Other curves Filling areas Text Patterns Polymarkers.
Rendering.
Lecture 15: Raster Graphics and Scan Conversion
CS552: Computer Graphics Lecture 17: Scan Conversion (Special Cases)
OUTPUT PRIMITIVES A.Aruna/Faculty of Information technology/SNSCE13/19/2016.
Computer Graphics CC416 Week 14 Filling Algorithms.
Attributes of Graphics Primitives Chapter 4
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
10/10/2006TCSS458A Isabelle Bichindaritz1 Line and Circle Drawing Algorithms.
Computer Graphics I, Fall 2010 Scan conversion algorithms.
Objectives Understand Bresenhams line drawing algorithm. Apply the algorithm to plot a line with the end points specified.
Primitive graphic objects
Pattern filling in scan-conversion Antialiasing
CSCE 441 Lecture 2: Scan Conversion of Lines
Raster Graphics.
Attributes of Graphics Primitives Hearn & Baker Chapter 4
Lecture 9 Line Drawing Algorithms (Bresenham’s Line Algorithm)
Introduction to Polygons
Implementation III.
Lecture 05: Mid-point Ellipse algorithm Dr. Manal Helal – Fall 2014
Chapter Three Part I Output Primitives CS 380.
Methods Anti-Aliasing Super Sampling
Introduction to Computer Graphics with WebGL
Line and Curve Drawing Algorithms
Computer Graphics Implementation III
Chapter 3 Graphics Output Primitives
NOTE.
Primitive Drawing Algorithm
Color Perception of color Color spaces
Polygons.
INTERACTIVE COMPUTER GRAPHICS
Presentation transcript:

Primitive Drawing Algorithm Graphics Laboratory Korea University

Contents Output Primitives Color Models How can we describe shapes with primitives? Color Models How can we describe and represent colors?

Output Primitives Points Lines Polygons DDA algorithm Bresenham’s algorithm Polygons Scan-line polygon fill Inside-outside tests Boundary-fill algorithm Anti-aliasing

Points Single coordinate position Set the color of the specified screen position Within the frame buffer x y

Lines Intermediate positions between two endpoints DDA, Bresenham’s line algorithms Jaggies / Aliasing

DDA Algorithm Digital differential analyzer (DDA) Algorithm overview Scan-conversion line algorithm for Based on calculating either y or x Algorithm overview Sample the line at unit intervals in one coordinate If |m| is below 1, sample in x coordinate Else, sample in y coordinate Determine corresponding integer values in other coordinate Until the final endpoint is reached

In the Case of |m| < 1 y y x x : Lost Pixel <When we sample in x coordinate> <When we sample in y coordinate>

Bresenham’s Line Algorithm (1 / 3) Accurate and efficient Use only incremental integer calculations Can be adapted to circles and other curves Specified Line Path 12 11 A 10 B 10 11 12 Which pixel is appropriate, A or B?

Bresenham’s Line Algorithm (2 / 3) Vertical pixel separation as d1, d2 From the mathematical line path If d1-d2 < 0, yk is selected Else, yk+1 is selected xk+1 yk yk+1 y d2 d1 |m| < 1

Bresenham’s Line Algorithm (3 / 3) Decision parameter pk The sign of pk is same as the sign of d1-d2 Due to x > 0 Parameter c is constant Independent of pixel position Incremental representation

Polygons Filling polygons Scan-line fill algorithm Inside-outside test Boundary fill algorithm 11 1 2 3 4 5 6 7 8 9 10 5 6 7 8 9 4 3 1 2

Scan-Line Polygon Fill Topological difference between 2 scan lines y: intersection edges are opposite sides y’: intersection edges are same side y 1 2 2 y’ 1 1

Scan-Line Polygon Fill (cont.) Edge Sorted Table B yC yB xC 1/mCB C C’ E yD yC’ xD 1/mDC yE xD 1/mDE D yA yE xA 1/mAE yB xA 1/mAB A 1 Scan-Line Number

Inside-Outside Tests Self-Intersections Odd-Even rule Nonzero winding number rule exterior interior

Boundary-Fill Algorithm Proceed to Neighboring Pixels 4-Connected 8-Connected

Antialiasing Supersampling (postfiltering) Pixel-weighting masks Area Sampling (prefiltering) Pixel phasing Shift the display location of pixel areas Micropositioning the electron beam in relation to object geometry

Supersampling Subpixels increase resolution Maximum intensity level: 9 22 (10, 20): Level 3 Intensity (11, 20): Level 1 Intensity (11, 21): Level 2 Intensity (12, 20): Level 3 Intensity 21 20 10 11 12

Weighted Supersampling Pixel-weighting masks More weights to subpixels near the center Maximum intensity level: 16 More variations in pixel intensity 1 2 4

Weighted Supersampling 22 (10, 20): Level 7 Intensity (11, 20): Level 1 Intensity (11, 21): Level 3 Intensity (12, 20): Level 5 Intensity 21 20 10 11 12

Area Sampling Intensity is proportional to overlapped area of each pixel 2 adjacent vertical (or horizontal) screen grid lines  trapezoid 22 (10, 20): 90% (10, 21): 10% 21 20 10 11 12

Filtering Techniques Filter Functions (Weighting Surface) Box Filter Cone Filter Gaussian Filter

Contents Output Primitives Color Models How can we describe shapes with primitives? Color Models How can we describe and represent colors?

Color Frame Buffer 255 150 75 255 150 75 255 150 75 Blue channel 255 150 75 255 150 75 Blue channel Green channel Red channel

Color Models RGB CMY HSV

RGB Color Model R G B Color Colors are additive 0.0 0.0 0.0 Black 1.0 Red 0.0 1.0 0.0 Green 0.0 0.0 1.0 Blue 1.0 1.0 0.0 Yellow 1.0 0.0 1.0 Magenta 0.0 1.0 1.0 Cyan 1.0 1.0 1.0 White

RGB Color Cube

CMY Color Model C M Y Color Colors are subtractive 0.0 0.0 0.0 White 1.0 0.0 0.0 Cyan 0.0 1.0 0.0 Magenta 0.0 0.0 1.0 Yellow 1.0 1.0 0.0 Blue 1.0 0.0 1.0 Green 0.0 1.0 1.0 Red 1.0 1.0 1.0 Black

CMY Color Cube

HSV Color Model Spectral color (Hue) Amount of white (Saturation) Black (Value) Hue Angle Saturation

HSV Color Model H S V Color 1.0 1.0 Red 60 1.0 1.0 Yellow 120 1.0 1.0 1.0 1.0 Red 60 1.0 1.0 Yellow 120 1.0 1.0 Green 180 1.0 1.0 Cyan 240 1.0 1.0 Blue 300 1.0 1.0 Magenta * 0.0 1.0 White * 0.0 0.5 Gray * * 0.0 Black

HSV Color Model Cross section of the HSV hexcone