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

Slides:



Advertisements
Similar presentations
Contents In today’s lecture we’ll have a look at:
Advertisements

Graphics Primitives Part II: Bresenhams line and circle.
Graphics Primitives: line
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.
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.
Scan conversion of Line , circle & ellipse
Line Drawing Algorithms. Rasterization-Process of determining which pixels give the best approximation to a desired line on the screen. Scan Conversion-Digitizing.
30/9/2008Lecture 21 Computer Graphics Assistant Professor Dr. Sana’a Wafa Al-Sayegh 2 nd Semester ITGD3107 University of Palestine.
OUTPUT PRIMITIVES Screen vs. World coordinate systems ● Objects positions are specified in a Cartesian coordinate system called World Coordinate.
In the name of God Computer Graphics Bastanfard.
Raster conversion algorithms for line and circle
Output Primitives Computer Graphics.
Graphics Output Primitives Pixel Addressing and Fill Area Dr. M. Al-Mulhem Feb. 1, 2008.
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.
CS 450: COMPUTER GRAPHICS DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE.
Circle Drawing algo..
Computer Graphics- SCC 342
1/1/20001 Topic >>>> Scan Conversion CSE Computer Graphics.
Jehee Lee Seoul National University
1 CPE 333 : Computer Graphics มหาวิทยาลัยเทคโนโลยีพระจอม เกล้าธนบุรี Dr. Natasha Dejdumrong.
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
Introduction to Computer Graphics PPT2: Graphics Output Primitives
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)
INT 840E Computer graphics Introduction & Graphic’s Architecture.
2D Output Primitives Points Lines Circles Ellipses Other curves Filling areas Text Patterns Polymarkers.
Chapter 3 Scan Conversion Lecture-02. Bresenham’s Line Algorithm Bresenham’s line algorithm – is a highly efficient incremental method for scan- converting.
Image Synthesis Rabie A. Ramadan, PhD 7. 2 Image Rasterization.
MIDPOINT CIRCLE & ELLIPSE GENERARTING ALGORITHMS
Midpoint Circle Algorithm
1 CSCE 441 Lecture 2: Scan Conversion of Lines Jinxiang Chai.
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.
Scan Conversion.
1 Teaching Innovation - Entrepreneurial - Global The Centre for Technology enabled Teaching & Learning, N Y S S, India DTEL DTEL (Department for Technology.
Bresenham’s Line Algorithm
OUTPUT PRIMITIVES A.Aruna/Faculty of Information technology/SNSCE13/19/2016.
Lecture 2: 19/4/1435 Graphical algorithms Lecturer/ Kawther Abas CS- 375 Graphics and Human Computer Interaction.
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
Rasterization CENG 477 Introduction to Computer Graphics Slides from Steve Marschner, CS4620, 2008 Cornell University.
Computer Graphics : output primitives.. 2 of 32 T1 – pp. 103–123, 137–145, 147–150, 164–171 Points and LinesPoints Line Drawing AlgorithmsLine Mid–Point.
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.
OUTPUT PRIMITIVES CEng 477 Computer Graphics METU, 2004.
Objectives Understand Bresenhams line drawing algorithm. Apply the algorithm to plot a line with the end points specified.
Primitive graphic objects
CSCE 441 Lecture 2: Scan Conversion of Lines
Raster Graphics.
Lecture 9 Line Drawing Algorithms (Bresenham’s Line Algorithm)
Lecture 8 Shear and Line Drawing Algorithms
Chapter Three Part I Output Primitives CS 380.
CSCE 441 Lecture 2: Scan Conversion of Lines
Introduction to Computer Graphics
Scan Conversion (From geometry to pixels)
Chapter 3 Graphics Output Primitives
Primitive Drawing Algorithm
Primitive Drawing Algorithm
Presentation transcript:

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

Output Primitives Output Primitives: Basic geometric structures (points, straight line segment, circles and other conic sections, quadric surfaces, spline curve and surfaces, polygon color areas, and character strings) These picture components are often defined in a continuous space.

Output Primitives In order to draw the primitive objects, one has to first scan convert the object. Scan convert: Refers to he operation of finding out the location of pixels to the intensified and then setting the values of corresponding bits, in the graphic memory, to the desired intensity code.

Output Primitives Each pixel on the display surface has a finite size depending on the screen resolution and hence a pixel cannot represent a single mathematical point.

Scan Converting A Point

Scan Converting A Point A mathematical point (x,y) needs to be scan converted to a pixel at location (x´, y´).

Scan Converting A Point x´=Round(x) and y´=Round(y) All points that satisfy: are mapped to pixel (x´,y´)

Scan Converting A Point x´=Round(x+0.5) and y´=Round(y+o.5) All points that satisfy: are mapped to pixel (x´,y´)

Scan Converting A Line

Scan Converting A Line The Cartesian slope- intercept equation for a straight line is:

Scan Converting A Line These equation form the basic for determining deflection voltage in analog devices. |m|<1 |m|>1

Scan Converting A Line On raster system, lines are plotted with pixels, and step size (horizontal & vertical direction) are constrained by pixel separation.

Scan Converting A Line We must sample a line at discrete positions and determine the nearest pixel to the line at each sampled position. X2

Digital Differential Analyzer (DDA Algorithm)

DDA Algorithm Algorithm is an incremental scan conversion method. Based on calculating either or If |m|<1,

DDA Algorithm If |m|>1, If

Bresenham’s Line Algorithm

Bresenham’s Line Algorithm A highly efficient incremental method for scan converting lines. Using only incremental integer calculation. By testing the sign of an integer parameter, whose value is proportional to the difference between the separation of two pixel positions from the actual line path.

Bresenham’s Line Algorithm A highly efficient incremental method for scan converting lines. Using only incremental integer calculation. By testing the sign of an integer parameter, whose value is proportional to the difference between the separation of two pixel positions from the actual line path.

Bresenham’s Line Algorithm

Bresenham’s Line Algorithm

Bresenham’s Line Algorithm y yk yk+1 xk+1 } d2 d1 y yk yk+1 xk+1 } d2 d1 y yk yk+1 xk+1 } d2 d1

Bresenham’s Line Algorithm d1 = y - yk = m (xk + 1) + b - yk d2 = (yk + 1) - y = yk + 1 - m (xk + 1) –b d1 - d2 = 2 m (xk + 1) - 2 yk + 2b -1

Bresenham’s Line Algorithm Pk = ΔX ( d1 - d2) = 2 ΔY . xk - 2 ΔX . yk + c c = constante = 2 ΔY + ΔX (2b -1)

Pk+1 = Pk + 2ΔY or = Pk + 2(ΔY – ΔX( Let's get rid of multiplications Pk+1 = 2 ΔY . xk+1 - 2 ΔX .y + c Pk+1 - Pk = 2 ΔY (xk+1 - xk) -2 ΔX (yk+1 - yk) (get rid of the constance) Pk+1 = Pk + 2 ΔY - 2 ΔX (yk+1 - yk) Pk+1 = Pk + 2ΔY      or      = Pk + 2(ΔY – ΔX( with (yk+1 - yk) = 0 or 1 depending on Pk sign

Bresenham’s Line Algorithm   P0 =ΔX (d1-d2) =ΔX[2m(x0+1)-2y0+2b-1] =ΔX[2(mx0+b-y0)+2m-1] P0=2ΔY -ΔX m=Δy/x

Bresenham’s Line Algorithm Example: Digitize the line with endpoint (20,10) and (30,18) ΔX=10 ΔY= 8 P0=2ΔY –Δx=6 2ΔY =16 2(ΔY – ΔX)=-4 P0=2ΔY –ΔX Pk+1 = Pk + 2ΔY      or      = Pk + 2(ΔY – ΔX(

Circle Generation Algorithms

Circle Generation Algorithms The equation of a circle: We could solve for y in terms of x

Circle Generation Algorithms The spacing between plotted pixel positions is not uniform.

Circle Generation Algorithms Computation can be reduced by considering the symmetry of circles 8 -Way symmetry

Midpoint Circle Algorithm

Circle Generation Algorithms As in the line algorithm, we sample at unit intervals and determine the closet pixel position to the circle path at each step.

Circle Generation Algorithms Points are generated from 90º to 45º, moves will be made only in the +x and –y direction. positive x direction over this octant and use a decision parameter

Circle Generation Algorithms We define a circle function:

Circle Generation Algorithms Midpoint Consider the coordinates of the point halfway between pixel T and pixel S Midpoint

Circle Generation Algorithms We use it to define a decision parameter

Circle Generation Algorithms If is negative, the midpoint is inside the pixel, and we choose pixel T. If we choose pixel S.

Circle Generation Algorithms Parameter for the next step is: since

Circle Generation Algorithms If T is chosen ( ) we have: If pixel S is chosen ( ) we have

Circle Generation Algorithms In terms of

Circle Generation Algorithms Initial value for the decision parameter using the original function of (0,r( When r is an integer we can simply set

Circle Generation Algorithms

Circle Generation Algorithms int x = 0; int y = radius; int p = 1 - radius; circlePoints(xCenter, yCenter, x, y, pix); while (x < y) { x++; if (p < 0) { p += 2*x+1; } else { y--; p += 2*(x-y+1); } circlePoints(xCenter, yCenter, x, y, pix); }

Circle Generation Algorithms Example: A circle radius r=10 x=0 to x=y P0=1-r = -9

Exercises?

Scan Converting Arcs And Sectors?

Character Generation

Character Generation Letters, numbers, and other character can be displayed in a variety of size and styles.

Character Generation Typeface: The overall design style for a set of characters is call typeface: Zar, nazanin, Titr. Font: Referred to a set of cast metal character forms in a particular size and forma: 10 point Zar.

Character Generation Two different representation are used for storing computer fonts: Bitmap font (or bitmapped font) Outline font

Bitmap font Bitmap font (or bitmapped font): A simple method for representing the character shapes in a particular typeface is to use rectangular grid pattern.

Bitmap font The character grid only need to be mapped to a frame buffer position. Bitmap fonts required more space, because each variation (size and format) must be stored in a font cash. Italic Bold

Outline Font Graphic primitives such as lines and arcs are used to define the outline of each character. Require less storage since variation does not require a distinct font cash.

Outline Font We can produce boldface, italic, or different size by manipulating the curve definition for the character outlines. It does take more time to process the outline fonts, because they must be scan converted into frame buffer. Outline font