Graphics System. Processor. Output Display. Input Devices. Frame Buffer. Memory. Array of pixels. Resolution: # of pixels Depth: # of bits/pixel

Similar documents
Scan Converting Lines

Chapter 8: Implementation- Clipping and Rasterization

Rendering. A simple X program to illustrate rendering

CPSC / Scan Conversion

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

From Ver(ces to Fragments: Rasteriza(on

CS 130. Scan Conversion. Raster Graphics

Scan Conversion. Lines and Circles

Rasteriza2on and Clipping

Rendering. A simple X program to illustrate rendering

Topic #1: Rasterization (Scan Conversion)

R asterisation. Part I: Simple Lines. Affine transformation. Transform Render. Rasterisation Line Rasterisation 2/16

Rasterization: Geometric Primitives

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

Line Drawing. Foundations of Computer Graphics Torsten Möller

Clipping and Scan Conversion

Clipping Points Consider a clip window which is rectangular in shape. P(x, y) is a point to be displayed.

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

Realtime 3D Computer Graphics Virtual Reality

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

Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática. Chap. 2 Rasterization.

Computer Graphics (CS 543) Lecture 9 (Part 2): Clipping. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

CS Rasterization. Junqiao Zhao 赵君峤

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Computer Graphics

Computer Graphics. - Rasterization - Philipp Slusallek

Department of Computer Sciences Graphics Fall 2003 (Lecture 2) Pixels

Digital Differential Analyzer Bresenhams Line Drawing Algorithm

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

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Scan Converting Circles

Computer Graphics D Graphics Algorithms

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

CS335 Fall 2007 Graphics and Multimedia. 2D Drawings: Lines

Rendering approaches. 1.image-oriented. 2.object-oriented. foreach pixel... 3D rendering pipeline. foreach object...

COMP371 COMPUTER GRAPHICS

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

Scan Conversion. Drawing Lines Drawing Circles

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

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

Line Drawing Week 6, Lecture 9

Chapter - 2: Geometry and Line Generations

From 3D World to 2D Screen. Hendrik Speleers

From Vertices To Fragments-1

Topics. From vertices to fragments

Last class. A vertex (w x, w y, w z, w) - clipping is in the - windowing and viewport normalized view volume if: - scan conversion/ rasterization

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

Computer Graphics and GPGPU Programming

Computer Graphics: 6-Rasterization

Painter s HSR Algorithm

3D Rendering Pipeline (for direct illumination)

CS488 2D Graphics. Luc RENAMBOT

1 Introduction to Graphics

Clipping Lines. Dr. Scott Schaefer

Raster Scan Displays. Framebuffer (Black and White)

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Clipping. Concepts, Algorithms for line clipping. 1 of 16. Andries van Dam. Clipping - 10/12/17

EF432. Introduction to spagetti and meatballs

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

CS602 MCQ,s for midterm paper with reference solved by Shahid

EF432. Introduction to spagetti and meatballs

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

Einführung in Visual Computing

Topic 0. Introduction: What Is Computer Graphics? CSC 418/2504: Computer Graphics EF432. Today s Topics. What is Computer Graphics?

Unit 2 Output Primitives and their Attributes

Computer Graphics 7 - Rasterisation

Efficient Plotting Algorithm

This library uses only GL functions but contains code for creating common objects and simplifying viewing.

MODULE - 4. e-pg Pathshala

Rasterization. COMP 575/770 Spring 2013

A Procedure to Clip Line Segment

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

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005

Clipping Algorithms; 8-5. Computer Graphics. Spring CS4815

Part 3: 2D Transformation

Two-Dimensional Viewing. Chapter 6

CS 543: Computer Graphics. Rasterization

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

Line Drawing Algorithms

CMSC 435/634: Introduction to Graphics

OXFORD ENGINEERING COLLEGE (NAAC Accredited with B Grade) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING LIST OF QUESTIONS

UNIT -8 IMPLEMENTATION

SRI VENKATESWARA COLLEGE OF ENGINEERING. COURSE DELIVERY PLAN - THEORY Page 1 of 6

Computer Graphics D Graphics Algorithms

Introduction to Computer Graphics (CS602) Lecture 05 Line Drawing Techniques

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

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

Graphics (Output) Primitives. Chapters 3 & 4

COURSE DELIVERY PLAN - THEORY Page 1 of 6

The Traditional Graphics Pipeline

Representations for Lines and Curves

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

The Traditional Graphics Pipeline

Overview of Computer Graphics

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

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

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

Pipeline implementation II

The Traditional Graphics Pipeline

More Raster Line Issues. Bresenham Circles. Once More: 8-Pt Symmetry. Only 1 Octant Needed. Spring 2013 CS5600

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

Rasterization. CS4620/5620: Lecture 12. Announcements. Turn in HW 1. PPA 1 out. Friday lecture. History of graphics PPA 1 in 4621.

Transcription:

Graphics System Input Devices Processor Memory Frame Buffer Output Display Array of pixels Resolution: # of pixels Depth: # of bits/pixel

Input Devices Physical Devices: Keyboard, Mouse, Tablet, etc. Logical Devices: High level interface with the user program Locator Valuator Pick Choice String Tablet Dial Light Pen Function Keys Keyboard 3D Input Devices: Spaceball, Data glove

Input Devices Reading Assignment: Foley van Dam Chapter 4 Hearn & Baker Chapter

Drawing Algorithms Rasterization Pixelization Scan Conversion Continuous Discrete

Line Drawing Algorithms Line Equation: (x,y ) y mx B y m dy dx y x - - y x 1 1 y x (x 1,y 1 ) x DDA (Digital Differential Analyzer)

Line Drawing Algorithms DDA (Digital Differential Analyzer) (x,y ) y y y y (x 1,y 1 ) x i mx i B mx i 1 B m( x x) i 1 i 1 i B

Line Drawing Algorithms (x 1,y 1 ) DDA (Digital Differential Analyzer) x (x,y ) y if x y x i 1 i 1 1 x y i i 1 m

Line Drawing Algorithms DDA (Digital Differential Analyzer) (x i, round(y i ) ) y y1 for (x x1; x x; x ) { Writepi xel(x, round (y)); y m; }

Line Drawing Algorithms DDA (Digital Differential Analyzer) m < 1 m > 1 Exchange the role of x and y

Line Drawing Algorithms Midpoint Line Algorithm Find on what side of the line the mid point is: above NE M Line If below then NE is closer to line If above then E is closer to line below E

Midpoint Line Algorithm NE M M M Line P(x p,y p ) E F(x, F(x, F(x, y) y) y) 0 : (x, > 0 : (x, < 0 : (x, y) y) y) on line below line above line

Midpoint Line Algorithm NE M Line P(x p,y p ) E M M Let 0 < m < 1 Consider line dy y x B dx F ( x, y ) ax by c 0 xdy - ydx Bdx 0 (a dy, b -dx, c Bdx)

Midpoint Line Algorithm NE M Line P(x p,y p ) E M M 1 F( M) F( xp 1, y p ) d 1 d a( xp 1) b( y p ) c if d > 0 Mis below the line,choosene if d < 0 Mis above the line,choosee

Midpoint Line Algorithm P(x p,y p ) NE E M M M Line WhenE : 1 dnew F( M') F( xp, y p ) 1 dnew a( xp ) b( y p ) c 1 dold a( xp 1) b( y p ) c dnew - dold a dy E

Midpoint Line Algorithm Line dx dy b a d d c y b x a d c y b x a d y x F M F d old new NE p p old p p new p p new - - ) 1 ( 1) ( ) 3 ( ) ( ) 3, ( '') ( WhenNE : M NE E M M P(x p,y p )

Midpoint Line Algorithm ) ( ), ( (division) dy - ) 1 ( 1) ( ) 1 1, ( At start : 0 0 0 0 0 0 c by ax y x F dx b a d b a c by ax d c y b x a y x F d start start start

Midpoint Line Algorithm dx x - x1; dy y - y1; d dy - dx; E dy; NE (dy - x x1; y y1; Writepixel(x,y); While (x < x) if d 0 d E; x 1; else d NE; x 1; y 1; end Writepixel(x,y); end While dx);

Midpoint Line Algorithm NE Line above M below E F(x,y) ax by c

Midpoint Line Algorithm above NE M Line NE M M M Line below E P(x p,y p ) E F(x,y) ax by c

Midpoint Circle Algorithm (x,y) x y R

Midpoint Circle Algorithm (x,y) x y R

Midpoint Circle Algorithm (x,y)

Midpoint Circle Algorithm (-x,y) (x,y) (-y,x) (-y,-x) (-x,-y) (x,-y) (y,x) (y,-x) 8-way symmetry: drawing in one octant is enough

Midpoint Circle Algorithm Consider II octant P(x p, y p ) E M SE M M F ( x, y ) x y R For a given point (x,y) F(x, y) 0 : (x,y) on circle F(x, y) > 0 : (x,y) outside circle F(x, y) < 0 :(x,y)inside circle

Midpoint Circle Algorithm Consider II octant P(x p, y p ) E M SE M M Evaluate F(M) If <0 (Minside circle) Choose E If >0 (Moutside circle) Choose SE

3 ) 1 ( ) ( ) 1, ( ') ( 0) WhenE (d ) 1 ( 1) ( ) 1 1, ( ) ( old < p old new E p p p p new p p p p old x d d R y x y x F M F d R y x y x F M F d Midpoint Circle Algorithm Consider II octant Raster Graphics M E SE M M P(x p, y p )

Midpoint Circle Algorithm Consider II octant Raster Graphics P(x p, y p ) E M SE M M When SE (d d ( x new SE p ) old F( M'') d new ( y d 0) F( x p, y 3 ) R x y old p p p p 3 ) 5

Midpoint Circle Algorithm Consider II octant Raster Graphics P(x p, y p ) E M SE M M Initial Condition (0, R) start point, next mid point (1, R - F(1, R 1 ) 5 4 R 1 )

Midpoint Circle Algorithm Consider II octant x 0; y R;d 5 4 Writepixel(x, y); - R; While (y > x) do if d < 0 d x 3; x 1; else d x - y 5; x 1; y- end Writepixel(x, y); end While 1;

Ellipse Drawing Algorithm E SE x a y b 1 S SE

Clipping Extraction of data/primitives inside a region of interest window > Discard (parts of ) primitives outside window. Point Clipping: Remove points outside window. A point is either entirely inside the window or not P (x L, y B ) Q (x R, y T ) x L < x < x R y B < y < y T Q is inside P is outside

Clipping Line Clipping: Remove portion of line segment outside window Can we use point clipping for the end points? 1 Point clipping works

Clipping Line Clipping: Remove portion of line segment outside window How about these lines? 3 5 4 Point clipping does not work

Clipping Cohen and Sutherland

Clipping Cohen and Sutherland 4 bit code to indicate the zone of end points of line with respect to window 1xxx xxx1 0000 xx1x x1xx

Clipping Cohen and Sutherland 4 bit code to indicate the zone of end points of line with respect to window 1001 1000 1010 0001 0000 0010 0101 0100 0110

Clipping Cohen and Sutherland Trivially accept case line is totally visible if both ends of the line have outcode as 0000 Trivially accept

Clipping Cohen and Sutherland Trivially reject case line is totally invisible logical AND of the two end points outcodes Trivially reject

Clipping Cohen and Sutherland If not trivially reject and accept case line is potentially visible Potentially visible

Clipping Cohen and Sutherland If potentially visible subdivide into segments and apply trivial acceptance and rejection test segments by intersection with window edges edges in any order but consistent (e.g., top-bottom, right-left) D B B A A Result

Clipping Cohen and Sutherland simple, still popular limited to rectangular region extension to 3D clipping using 3D orthographic view volume is straightforward