1 Computer Graphics Week5 – Shapes & Scan Conversion.

Slides:



Advertisements
Similar presentations
Computer Graphics- SCC 342
Advertisements

CS 450: COMPUTER GRAPHICS DRAWING ELLIPSES AND OTHER CURVES SPRING 2015 DR. MICHAEL J. REALE.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/6103b – Shapes Lecture 03b: Shapes COMP 175: Computer Graphics February 3, 2015.
CS 376 Introduction to Computer Graphics 02 / 02 / 2007 Instructor: Michael Eckmann.
Scan Conversion A. Samal. Scan Conversion Last step in the graphics pipeline Efficiency is a central issue Common primitives – Lines – Polygons – Circles.
+ 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.
30/9/2008Lecture 21 Computer Graphics Assistant Professor Dr. Sana’a Wafa Al-Sayegh 2 nd Semester ITGD3107 University of Palestine.
CMPE 466 COMPUTER GRAPHICS
ENS 207 engineering graphics
Polar Coordinate System 11.3 – Polar Coordinates Used to plot and analyze equations of conics (circles, parabolas, ellipses, and hyperbolas. Another method.
Output Primitives Computer Graphics.
Computer Graphics - Class 14
Graphics Output Primitives Pixel Addressing and Fill Area Dr. M. Al-Mulhem Feb. 1, 2008.
ENDS 375 Foundations of Visualization Geometric Representation 9/30/04.
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.
Distance and Midpoint Formulas The distance d between the points (x 1, y 1 ) and (x 2, y 2 ) is given by the distance formula: The coordinates of the point.
Polar Graphs and Calculus
3-D Modeling Concepts V part 2.
Dr. S.M. Malaek Assistant: M. Younesi
Jehee Lee Seoul National University
CS 450: COMPUTER GRAPHICS REVIEW: DRAWING ELLIPSES AND OTHER CURVES SPRING 2015 DR. MICHAEL J. REALE.
CS 376 Introduction to Computer Graphics 04 / 23 / 2007 Instructor: Michael Eckmann.
Jeopardy Geometry Circles 1 Triangles 2 Polygons 3 Formulas 4 Angles 5 Pot Luck
Drawing Curves Lecture 9 Mon, Sep 15, Drawing Functions If f(x) is a function, then thanks to the vertical-line test, for each value of x, there.
POLYGONS. BUILDING POLYGONS We use line segments to build polygons. A polygon is a closed shape with straight sides.
IE433 CAD/CAM Computer Aided Design and Computer Aided Manufacturing Part-5 Representation and Manipulation of Curves Dr. Abdulrahman M. Al-Ahmari Industrial.
Graphics Output Primitives
Geometry Angie Bordwell, Vertis Lewis, Lissa Purpura, and Jean Tuquero.
CGMB214: Introduction to Computer Graphics
1 CS 430/536 Computer Graphics I Curve Drawing Algorithms Week 4, Lecture 8 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent Computing.
50 Miscellaneous Parabolas Hyperbolas Ellipses Circles
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
Period 5 Nathan Rodriguez. -Point  a geometric element that has position but no extension; "a point is defined by its coordinates"
Slide Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Sullivan Algebra and Trigonometry: Section 11.5 Objectives of this Section Identify a Conic Use a Rotation of Axes to Transform Equations Discuss an Equation.
Circles – An Introduction SPI Graph conic sections (circles, parabolas, ellipses and hyperbolas) and understand the relationship between the.
Jeopardy Terminology Geometry This PowerPoint was revised from the original version from; geometry.ppt.
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.
Algebra Conic Section Review. Review Conic Section 1. Why is this section called conic section? 2. Review equation of each conic section A summary of.
CS 325 Introduction to Computer Graphics 02 / 03 / 2010 Instructor: Michael Eckmann.
CSC418 Computer Graphics n Polygons –Triangulation –Scan conversion –Convex/Concave – clipping) n 2D affine transformations and properties, Homogeneous.
1 CSCE 441 Lecture 2: Scan Conversion of Lines Jinxiang Chai.
Conics Review Study Hard!. Name the Conic without graphing and write it in standard form X 2 + Y 2 -4Y-12=0.
Chapter 8 Engineering Geometry
Find the distance between (-4, 2) and (6, -3). Find the midpoint of the segment connecting (3, -2) and (4, 5).
Lecture 15: Raster Graphics and Scan Conversion
The Canvas Class Lecture 8 Fri, Sep 12, The Canvas Class We will create a simple Canvas class that will encapsulate the commands that create and.
OUTPUT PRIMITIVES A.Aruna/Faculty of Information technology/SNSCE13/19/2016.
Computer Graphics Lecture 08 Taqdees A. Siddiqi Computer Graphics Filled Area Primitives I Lecture 08 Taqdees A. Siddiqi
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.
Chapter 7: Trigonometric Functions Section 7.1: Measurement of Angles.
Jeopardy Terminology Quiz Geometry All points on a circle are the same distance from this point. (100)
Plane Figures. What are the types of figures? A closed figure begins and ends at the same end point. An open figure has ends that do not meet.
Computer Graphics Lecture 07 Ellipse and Other Curves Taqdees A. Siddiqi
Computer Graphics Lecture 06 Circle Drawing Techniques Taqdees A. Siddiqi
Rasterization CENG 477 Introduction to Computer Graphics Slides from Steve Marschner, CS4620, 2008 Cornell University.
Computer Graphics Drawing Line.
Chapter 10 Conic Sections
Lecture 5 Basic geometric objects
The Dance of the Foci David Seppala-Holtzman St. Joseph’s College
Point-a location on a plane.
Additional Drawing Tools
In this chapter, you will learn the following:
Scan Conversion (From geometry to pixels)
Chapter 3 Graphics Output Primitives
Polygons.
Presentation transcript:

1 Computer Graphics Week5 – Shapes & Scan Conversion

Shapes and Scan Converting The process by which an idealized shape, such as a line or a circle, is transformed into the correct "on" values for a group of pixels on the computer is called scan conversion and is also referred to as rasterizing. 2

1-Line and linear shapes The most popular line-drawing algorithm is the midpoint-line algorithm. This algorithm takes the x- and y- coordinates of a line's endpoints as input and then calculates the x, y-coordinate pairs of all the pixels in between. 3

Basic linear shapes such as triangles and polygons can be defined by a series of lines. A polygon is defined by n number of vertices connected by lines, where n is the number of sides in the polygon. A quadrilateral, which is a special case of a polygon is defined by four vertices, and a triangle is a polygon with three vertices 4

Relative drawing void moveTo(GlPoint point){ currPoint = point; } void lineTo(GlPoint point) { glBegin(GL_LINES); glVertex2f(currPoint.x,currPoint.y); glVertex2f(point.x, point.y); //draw the line glEnd(); currPoint= point; //update current point to new point glFlush(); } 5

6

OpenGL geometric primitive types 7

2-Circle and hyperbolic shapes The basic mechanics for these algorithms are the same as for lines: figure out the pixels along the path of the shape, and turn the appropriate pixels on. Interestingly, we can also draw a curved segment by approximating its shape using line segments. The smaller the segments, the closer the approximation. 8

For example, consider a circle. Recall from trigonometry that any point on a circle of radius r (and centered at the origin) has an x, y-coordinate pair that can be represented as a function of the angle theta the point makes with the axes 9

10 Points along a circle

11

2D-Graphical objects PolyLines- input from -file -interactive (using mouse) -computed (using relative drawing) Curves -implicit form -parametric form 12

Drawing circle void drawCircle (Point2 center, float radius) { const int numVerts = 50; // use larger value for a better circle ngon(numVerts, center.getX(), center.getY(), radius, 0); } 13

Drawing Arcs void drawArc(GlPoint center, float radius, float startAngle, float sweep) { // startAngle and sweep are in degrees const int n = 30; // number of intermediate segments in arc float angle = startAngle * / 180; // initial angle in radians float angleInc = sweep * /(180 * n); // angle increment GlPoint point; point.x=center.x+ radius * cos(angle); point.y=center.y+ radius * sin(angle); moveTo(point); for(int k = 1; k < n; k++, angle += angleInc){ point.x=center.x+ radius * cos(angle); point.y=center.y+ radius * sin(angle); lineTo(point); } } 14

Curves Implicit form F(x,y) = 0 Straight line F(x,y)=(y-A 2 )(B 1 –A 1 )-(x-A 1 )(B 2 –A 2 ) Circle F(x,y)= x 2 +y 2 – R 2 Inside – outside function F(x,y) 0 outside the curve 15

Curves Parametric form – CurrentPoint = (x(t), y(t)) t Î T Straight line x(t) = A 1 +t(B 1 –A 1 ) y(t) = A 2 +t(B 2 –A 2 ) Ellipse x(t) = A.cos(t) // A is width of ellipse y(t) = B.sin(t) // B is heigth of ellipse 16

Drawing ellipse void drawEllipse(GlPoint center,float A,float B) { float cx=center.x; float cy=center.y; GlPoint point; point.x=cx+A; point.y=cy; moveTo(point); for (float t=0.0; t<=TWOPI+0.01; t+=TWOPI/100) { point.x=cx+A*cos(t); point.y=cy+B*sin(t); lineTo(point); } glFlush(); } 17

Other conic sections Parabola F(x,y)= y 2 -4ax x(t)=at 2 y(t)=2at Hyperbola F(x,y)= (x/a) 2 - (y/b) 2 -1 x(t)=a/cos(t)y(t)=b.sin(t)/cos(t) 18