Graphics Output Primitives

Similar documents
Einführung in Visual Computing

Computer Graphics. Lecture 3 Graphics Output Primitives. Somsak Walairacht, Computer Engineering, KMITL

GRAPHICS OUTPUT PRIMITIVES

Computer Graphics. Modelling in 2D. 2D primitives. Lines and Polylines. OpenGL polygon primitives. Special polygons

Prof. Feng Liu. Fall /25/2018

OUTPUT PRIMITIVES. CEng 477 Introduction to Computer Graphics METU, 2007

Graphics (Output) Primitives. Chapters 3 & 4

Rasterization: Geometric Primitives

Computer Graphics: Graphics Output Primitives Line Drawing Algorithms

Output Primitives. Dr. S.M. Malaek. Assistant: M. Younesi

Scan Conversion. CMP 477 Computer Graphics S. A. Arekete

Attributes of Graphics Primitives

Unit 2 Output Primitives and their Attributes

Raster Displays and Scan Conversion. Computer Graphics, CSCD18 Fall 2008 Instructor: Leonid Sigal

Computer Graphics. Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Chapter 3. Sukhwinder Singh

CSCI 4620/8626. Coordinate Reference Frames

CS 450: COMPUTER GRAPHICS RASTERIZING LINES SPRING 2016 DR. MICHAEL J. REALE

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics

Computer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Chapter - 2: Geometry and Line Generations

COMP371 COMPUTER GRAPHICS

Two Dimensional Viewing

Chapter 8: Implementation- Clipping and Rasterization

Topic #1: Rasterization (Scan Conversion)

2D Image Synthesis. 2D image synthesis. Raster graphics systems. Modeling transformation. Vectorization. u x u y 0. o x o y 1

Filled Area Primitives. CEng 477 Introduction to Computer Graphics METU, 2007

What and Why Transformations?

Rasterization, or What is glbegin(gl_lines) really doing?

Today s class. Geometric objects and transformations. Informationsteknologi. Wednesday, November 7, 2007 Computer Graphics - Class 5 1

Fall CSCI 420: Computer Graphics. 7.1 Rasterization. Hao Li.

CS 325 Computer Graphics

Practical Linear Algebra: A Geometry Toolbox

CSC Computer Graphics

Pipeline implementation II

Plot and connect the points in a coordinate plane to make a polygon. Name the polygon.

CSCI 420 Computer Graphics Lecture 14. Rasterization. Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California

Scan Conversion. Drawing Lines Drawing Circles

UNIT 2 GRAPHIC PRIMITIVES

Rasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA)

CS 543: Computer Graphics. Rasterization

1 Introduction to Graphics

12.4 Rotations. Learning Objectives. Review Queue. Defining Rotations Rotations

CSC Computer Graphics

UNIT -8 IMPLEMENTATION

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives.

Glossary alternate interior angles absolute value function Example alternate exterior angles Example angle of rotation Example

Line Drawing Week 6, Lecture 9

RASTERIZING POLYGONS IN IMAGE SPACE

Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing

Midterm Review. Wen-Chieh (Steve) Lin Department of Computer Science

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling

Line Drawing. Introduction to Computer Graphics Torsten Möller / Mike Phillips. Machiraju/Zhang/Möller

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

KRISTU JYOTI COLLEGE OF MANAGEMENT & TECHNOLOGY QUESTION BANK BCA SEMESTER III Computer graphics Part A (2 marks questions)

Implementation III. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Topics. From vertices to fragments

Polygon Filling. Can write frame buffer one word at time rather than one bit. 2/3/2000 CS 4/57101 Lecture 6 1

Reteaching Golden Ratio

Rasteriza2on and Clipping

CS 548: COMPUTER GRAPHICS DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE

A rotation is a transformation that turns a figure around a point, called the.

ANGLES See the Math Notes boxes in Lessons and for more information about angle relationships.

From Ver(ces to Fragments: Rasteriza(on

Werner Purgathofer

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14

Computer Graphics. - Rasterization - Philipp Slusallek

Pre-Algebra Notes Unit 13: Angle Relationships and Transformations

Incremental Form. Idea. More efficient if we look at d k, the value of the decision variable at x = k

In today s lecture we ll have a look at: A simple technique The mid-point circle algorithm

0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves

Alternate Angles. Clip 67. Mathswatch

Lab Manual. Computer Graphics. T.E. Computer. (Sem VI)

Grade 6 Math Circles February 29, D Geometry

4.2 Start Thinking. 4.2 Warm Up. 4.2 Cumulative Review Warm Up

Computer Graphics. Lecture 2. Doç. Dr. Mehmet Gokturk

Cs602-computer graphics MCQS MIDTERM EXAMINATION SOLVED BY ~ LIBRIANSMINE ~

CS 157: Assignment 6

Realtime 3D Computer Graphics Virtual Reality

Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by:

CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu

Connecting Algebra and Geometry with Polygons

1 Points and Distances

Section 9.3: Functions and their Graphs

2D Graphics Primitives II. Additional issues in scan converting lines. 1)Endpoint order. Want algorithms to draw the same pixels for each line

Digital Differential Analyzer Bresenhams Line Drawing Algorithm

Computer Graphics D Graphics Algorithms

= = The number system. Module. Glossary Math Tools... 33

EF432. Introduction to spagetti and meatballs

Think About. Unit 5 Lesson 3. Investigation. This Situation. Name: a Where do you think the origin of a coordinate system was placed in creating this

2D Viewing. Viewing Pipeline: Window-Viewport Transf.

Methods. Lesson 2 PRACTICE PROBLEMS Coordinate Models of Transformations

Computer Graphics 7 - Rasterisation

VALLIAMMAI ENGINEERING COLLEGE

Raster Graphics Algorithms

12.1. Angle Relationships. Identifying Complementary, Supplementary Angles. Goal: Classify special pairs of angles. Vocabulary. Complementary. angles.

CS 335 Graphics and Multimedia. Geometric Warping

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Transcription:

Important Graphics Output Primitives Graphics Output Primitives in 2D polgons, circles, ellipses & other curves piel arra operations in 3D triangles & other polgons Werner Purgathofer / Computergraphik Points and Lines point plotting instruction in displa list (random scan) entr in frame buffer (raster scan) line drawing instruction in displa list (random scan) intermediate discrete piel positions calculated (raster scan) jaggies, aliasing Lines: Staircase Effect Stairstep effect (jaggies) produced when a line is generated as a series of piel positions Werner Purgathofer / Computergraphik 2 Werner Purgathofer / Computergraphik 3 Line-Drawing Algorithms DDA Line-Drawing Algorithm line equation: = m. + b line path between two points: m = end 0 end 0 b = 0 m. 0 end 0 }b 0 end line equation: = m. + b δ = m. δ δ = δ m for m < for m > end 0 DDA (digital differential analzer) 5 sampling points 0 end for δ=, m < : k+ = k + m Werner Purgathofer / Computergraphik 4 Werner Purgathofer / Computergraphik 5

DDA Algorithm Principle d = End 0; d = End 0; m = d / d; = 0; = 0; setpiel (round(), round()); for (k = 0; k < d; k++) { += ; += m; setpiel (round(), round()} etension to other cases simple Werner Purgathofer / Computergraphik 6 Bresenham s Line Algorithm faster than simple DDA incremental integer calculations adaptable to circles, other curves 3 2 0 = m. ( k + ) + b 0 2 3 Werner Purgathofer / Computergraphik 7 Section of a displa screen where a straight line segment is to be plotted, starting from the piel at column 0 on scan line Bresenham s Line Algorithm Bresenham s Line Algorithm (/4) k+2 k+ k = m + b Section of the screen grid showing a piel in column k on scan line k that is to be plotted along the path of a line segment with slope 0<m< k+ k dupper d lower k k+ k+2 k+3 Werner Purgathofer / Computergraphik 8 k k+ Werner Purgathofer / Computergraphik 9 k+ Bresenham s Line Algorithm (/4) k d upper d lower Werner Purgathofer / Computergraphik k+ 0 = m. ( k + ) + b d lower = k = = m. ( k + ) + b k d upper = ( k + ) = = k + m. ( k + ) b d lower d upper = = 2m. ( k + ) 2 k + 2b k+ Bresenham s Line Algorithm (2/4) k d upper d lower Werner Purgathofer / Computergraphik k+ d lower d upper = = 2m. ( k + ) 2 k + 2b m = Δ/Δ (Δ= end 0, Δ = end 0 ) decision parameter: p k = Δ. (d lower d upper ) = = 2Δ. k 2Δ. k + c same sign as (d lower d upper ) 2

Bresenham s Line Algorithm (3/4) current decision value: p k = Δ. (d lower d upper ) = 2Δ. k 2Δ. k + c net decision value: p = 2Δ. k+ 2Δ. k+ k+ + c + 0 + p k 2Δ. k + 2Δ. k c = = p k + 2Δ 2Δ. ( k+ k ) starting decision value: p 0 = 2Δ Δ Werner Purgathofer / Computergraphik 2 Bresenham s Line Algorithm (4/4). store left line endpoint in ( 0, 0 ) 2. plot piel ( 0, 0 ) 3. calculate constants Δ, Δ, 2Δ, 2Δ 2Δ, and obtain p 0 =2Δ Δ 4. At each k along the line, perform test: if p k <0 then plot piel ( k +, k ); p k+ = p k + 2Δ else plot piel ( k +, k +); p k+ = p k + 2Δ 2Δ 5. perform step 4 (Δ ) times. Werner Purgathofer / Computergraphik 3 Bresenham: Eample k p k ( k+, k+ ) (20,4) 0-4 (2,4) 2 (22,42) 2-2 (23,42) 3-6 (24,42) 4 0 (25,43) 5-4 (26,43) 6-8 (27,43) 7-2 (28,43) 8 4 (29,44) 9-0 (30,44) Werner Purgathofer / Computergraphik 4 46 Δ = 0, Δ = 3 45 44 43 42 4 40 20 2 22 23 24 25 26 27 28 29 30 p 0 =2Δ Δ if p k <0 then plot piel ( k +, k ); p k+ = p k + 2Δ else plot piel ( k +, k +); p k+ = p k + 2Δ 2Δ Important Graphics Output Primitives In 2D polgons, circles, ellipses & other curves piel arra operations In 3D triangles & other polgons Werner Purgathofer / Computergraphik 5 What is Inside a Polgon? Fill-Area Primitives for polgon area (solid-color, patterned) scan-line polgon fill algorithm intersection points located and sorted consecutive pairs define interior span attention with verte intersections eploit coherence (incremental calculations) flood fill algorithm Odd Even rule Nonzero Winding Number rule??? Werner Purgathofer / Computergraphik 6 Werner Purgathofer / Computergraphik 7 3

Polgon Fill Areas polgon classifications conve: no interior angle > 80 concave: not conve splitting concave polgons vector method all vector cross products have the same sign conve rotational method rotate polgon-edges onto -ais, alwas same direction conve Werner Purgathofer / Computergraphik 8 Important Graphics Output Primitives In 2D polgons, circles, ellipses & other curves piel arra operations In 3D triangles & other polgons Werner Purgathofer / Computergraphik 9 Character Primitives Eample: Newspaper font (tpeface) design stle for (famil of) Courier, Times, Arial, serif (better readable), Sfzrn Sfzrn sans serif (better legible) definition model bitmap font (simple to define and displa), needs more space (font cache) outline font (more costl, less space, geometric transformations) Werner Purgathofer / Computergraphik 20 Werner Purgathofer / Computergraphik 2 Character Generation Eamples the letter B represented with an 88 bilevel bitmap pattern and with an outline shape defined with straight line and curve segments Werner Purgathofer / Computergraphik 22 Important Graphics Output Primitives In 2D polgons, circles, ellipses & other curves piel arra operations In 3D triangles & other polgons Werner Purgathofer / Computergraphik 23 4

Polgon Surfaces () set of surface polgons enclose object interior = Boundar Representation ( B-rep ) Polgon Surfaces (2) polgon tables (B-rep lists) geometric and attribute tables verte, edge, polgon tables consistenc, completeness checks Eample of a triangle mesh representing a dolphin. Werner Purgathofer / Computergraphik 24 Werner Purgathofer / Computergraphik 25 Polgon Surfaces: Data Structure Lists for B-Reps surface list V E E 3 E 6 S S 2 S S 2 E 2 E 4 V 2 V 3 V 4 V 5 E5 edge list E E 2 E 3 E 4 E 5 E 6 Werner Purgathofer / Computergraphik 26 verte list z V z V 2 Werner Purgathofer / Computergraphik 27 z V 3 z V 4 z V 5 Polgon Surfaces: Plane Equation plane parameters A,B,C,D normal (A,B,C) A + B + Cz + D = 0 N=(A,B,C) eample: = 0 N=(,0,0) Front and Back Polgon Faces back face = polgon side that faces into the object interior front face = polgon side that faces outward behind a polgon plane = visible to the polgon back face in front of a polgon plane = visible to the polgon front face z z Werner Purgathofer / Computergraphik 28 Werner Purgathofer / Computergraphik 29 5

Front and Back Polgon Faces A + B + Cz + D = 0 for points on the surface < 0 for points behind > 0 for points in front if () right-handed coordinate sstem (2) polgon points ordered V 4 counterclockwise V V 2 V,V 2,V 3 counterclockwise normal vector N = (V 2 -V ) (V 3 -V ) Werner Purgathofer / Computergraphik 30 V 5 V 3 N Reminder: Product of Vectors a V = b V 2 = c scalar product: a b c a 2 b 2 c 2 V V 2 = = a a 2 + b b 2 + c c 2 cross product (vector product): a b c a 2 b 2 c 2 V V 2 = = Werner Purgathofer / Computergraphik 3 a 2 b 2 c 2 b c 2 c b 2 c a 2 a c 2 a b 2 b a 2 6