2 Pages

Bresenham-handout

Course: ECE 3090, Spring 2012
School: Georgia Tech
Rating:
 
 
 
 
 

Word Count: 520

Document Preview

Line Bresenhams and Circle Algorithms Introduction. Graphics images consist of individual Picture Elements (Pixels), which are a single point in the image. For color images, each pixel has color components for the Red, Green, and Blue parts of the color, which are generally specied individually. To draw a line or a circle on a graphical display, we need an algorithm to do scan conversion. That is, for a line we...

Register Now

Unformatted Document Excerpt

Coursehero >> Georgia >> Georgia Tech >> ECE 3090

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Line Bresenhams and Circle Algorithms Introduction. Graphics images consist of individual Picture Elements (Pixels), which are a single point in the image. For color images, each pixel has color components for the Red, Green, and Blue parts of the color, which are generally specied individually. To draw a line or a circle on a graphical display, we need an algorithm to do scan conversion. That is, for a line we are just given the two endpoints as a pair of (x,y) coordinates, and we must determine which pixels are part of the specied line and set those pixels to the appropriate color. Similarly, for circles we are just given the center point (x,y) and the radius. Here, we will discuss two algorithms for scan converting lines and circles. For further details, both of these algorithms are described in Computer Graphics by Jim Foley and Andries van Dam. Bresenhams MidPoint Line Algorithm. We could easily design an algorithm to draw a line, using oating point values for the slope of the line, and then rounding to an integer to set the appropriate pixel. However, oating point computation in a CPU is substantially more complex (and takes longer) than integer arithmetic. Given this, J. E. Bresenham developed an algorithm for line drawings that uses integer arithmetic only. The algorithm is given below: void MidpointLine(int x0, int y0, int x1, int y1) { int dx = x1 - x0; int dy = y1 - y0; int d = 2 * dy - dx; int incrE = 2 * dy; // East increment int incrNE = 2 * (dy - dx); // Northeast increment int x = x0; // Initial int x y = y0; // Initial y SetPixel(x, y); // Initial line point while(x < x1) { if (d <= 0) { d += incrE; // Move East } else { d += incrNE; // Move Northeast y++; // and advance y } x++; SetPixel(x, y); // Next pixel in line } } It is IMPORTANT to note that this algorithm only works for lines where x1 > x0 and for slope (dy/dx) between 0 and 1.0. You must modify the algorithm to work for the other cases as well. Further, take care to handle the case of innite slope lines (x1 == x0). 1 Bresenhams Midpoint Circle Algorithm. For drawing circles, we could easily develop an algorithm that makes use of trigonometric functions such as sin and cosine to nd the points on a circle. However, as in the case of line drawing, efciency is of importance, and we would like an algorithm that uses simple integer arithmetic as much as possible, and in particular does not use expensive trig functions. Bresenham developed a circle drawing algorithm that does exactly this, using mostly integer arithmetic, as follows. This algorithm assumes the circle center is at (0,0). void MidpointCircle(int r) { int x = 0; int y = radius; double d = 5.0/4.0 - radius; SetPixel(x,y); while(y > x) { if (d < 0) { d += 2.0 * x + 3.0; // Select East } else { d += 2.0 * (x-y) + 5.0; // Select SE y--; } x++; SetPixel(x, y); } } It is IMPORTANT to note that this algorithm only draws oneeighth of a circle, in the range of 0 to 45 degrees. You must modify the algorithm to draw properly the remaining seven eighths of the circle. 2
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Georgia Tech - ECE - 3090
/ Example C+ Classes / George F. Riley, Georgia Tech, Spring 2009 #include &lt;iostream&gt; / Needed for the &quot;cout&quot; commands using namespace std; / Define a C Structure called TwoInt_t typedef struct cfw_ int a; int b; TwoInt_t; void PrintTwo(TwoInt_t* ti) cfw
Georgia Tech - ECE - 3090
ECE3090Fall Semester, 2009Project 1 Complex Number CalculatorAssigned: Aug 24, 2009 Due: Aug 31, 2009 11:59pmIn this assignment, we will create a calculator that perform simple arithmetic operations on complex numbers. Complex values are denoted by a
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Demonstrate constructors and destructors / George F. Riley, Georgia Tech, Spring 2009 #include
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Example illusrating dynamic memory management / ECE3090 / George F. Riley, Georgia Tech, Sprin
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ / / /Example illusrating dynamic memory management for a class that uses dynamic memory as a
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Example C+ Classes / George F. Riley, Georgia Tech, Spring 2009 #include &lt;iostream&gt; / Needed f
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Example demonstrating memory addess assignments / George F. Riley, Georgia Tech, Fall 2009 int
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Demonstrate use of C+ Exceptions / George F. Riley, Georgia Tech, Fall 2009 #include #include
Georgia Tech - ECE - 3090
ECE3090Fall Semester, 2009Project 3 The Fast Fourier TransformAssigned: Sept 16, 2009Due: Sep 30, 2009, 11:59pmGiven an array of length N containing complex discretetime samples of some signal h, the Discrete FourierTransform (DFT) H is also an arra
Georgia Tech - ECE - 3090
ECE3090Fall Semester, 2009Project 4 The Distributed TwoDimensional Fourier TransformAssigned: Oct 14, 2009 Due: Oct 30, 2009, 11:59pmGiven a twodimensional matrix of complex input values, the twodimensional Fourier Transform can be computed with two s
Georgia Tech - ECE - 3090
/ An implementation of a simplified STL Vector / George F. Riley, Georgia Tech, Fall 2009 template&lt;class T&gt; class GFRVec cfw_ public: GFRVec() : first(0), last(0), end(0) cfw_ GFRVec(size_t n) cfw_ / Create a GFRVec with &quot;n&quot; copies of T, with default cons
Georgia Tech - ECE - 3090
ECE3090Fall Semester, 2009Image Noise FilteringIntroduction. High frequency signal noise is often a problem in real-world applications. For example, this noisemanifests itself as &quot;static&quot; on phone lines or a fuzzy television reception, or snow in vide
Georgia Tech - ECE - 3090
123456789101112131415161718192021222324252627/ Try some image rotation algorithms./ George F. Riley, Georgia Tech, Fall 2009#include &lt;iostream&gt;#include &quot;qdisplay.h&quot;#include &lt;qpainter&gt;#include &quot;math.h&quot;using namespace std;/
Georgia Tech - ECE - 3090
/ Demonstrate the STL &quot;sorted associative containers, map, set / multimap and multiset. / George F. Riley, Georgia Tech, Summer 2006 #include &lt;iostream&gt; #include &lt;map&gt; #include &lt;set&gt; using namespace std; / Generic subroutine to print a container template
Georgia Tech - ECE - 3090
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556/ Demonstrate the STL &quot;sorted associative containers, map, set/ multimap and multiset./ George
Georgia Tech - ECE - 3090
ECE3090Fall Semester, 2009Project 2 Matrix CalculatorAssigned: Sep 2, 2009 Due: Sep 16, 2009, 11:59pmIntroduction. We will extend our previously developed complex calculator to provide for the simple matrix operations add, subtract and multiply (we wo
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Example illusrating member functions / ECE3090 / George F. Riley, Georgia Tech, Spring 2009 #i
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ / / /2D FFT Using threads George F. Riley, Georgia Tech, Fall 2009 This illustrates how a mut
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Copying an object from a base class pointer. / George F. Riley, Georgia Tech, Fall 2009 / ECE3
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Operator overloading / George F. Riley, Georgia Tech, Spring 2009 #include &lt;stdio.h&gt; #include
Georgia Tech - ECE - 3090
/ Operator overloading / George F. Riley, Georgia Tech, Spring 2009 #include &lt;stdio.h&gt; #include &lt;iostream&gt; using namespace std; / Define class A with a default constructor, non-default constructor, / and a &quot;Copy Constructor&quot; class A cfw_ public: A(); / De
Georgia Tech - ECE - 3090
ECE3090Fall Semester, 2009FINAL Project - Path Discovery and Obstacle AvoidanceAssigned: Nov 11, 2009 Due: Dec 7, 2009, Final Exam PeriodIntroduction. The objective of this assignment is to navigate an avatar from a starting position to an ending posi
Georgia Tech - ECE - 3090
ECE3090Fall Semester, 2009Project 5 Wireless Path LossAssigned: Oct 31, 2009 Due: Nov 13, 2009, 11:59pmGiven a wireless base station with a given transmitter power Pt , we want to compute the received power at a wireless mobile device at every point i
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Demonstrate class inheritance and polymorphism, and pure virtual functions / George F. Riley,
Georgia Tech - ECE - 3090
ECE3090Fall Semester, 2009The QDisplay APIIntroduction. The next two assignments for ECE3090 (the last regular project as well as the nal project) will require a graphical interface for you to use to display and manipulate images. There are many differ
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Demonstrate references, const references, const member functions, / ECE3090 / George F. Riley,
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Demonstrate &quot;Smart Pointers&quot;. / ECE 3090 - Fall 2009 / George F. Riley, Georgia Tech, Fall 200
Georgia Tech - ECE - 3090
/ Demonstrate &quot;Smart Pointers&quot;. / ECE 3090 - Fall 2009 / George F. Riley, Georgia Tech, Fall 2006 / / / / This example demonstrates the use of &quot;smart pointers&quot;, that keep up with how many references there are to each allocated memory block, and only free
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38/ Demonstrate a few attempts at efficient &quot;sorted data structures&quot; / George F. Riley, Georgia Tech, Fall 2009 / / / / The objective is to design a &quot;co
Georgia Tech - ECE - 3090
/ Demonstrate the front_inserter, back_inserter, ostream_iterator, / and functors. / George F. Riley, Georgia Tech, Fall 2009 #include #include #include #include #include #include &lt;iostream&gt; &lt;algorithm&gt; &lt;vector&gt; &lt;set&gt; &lt;deque&gt; &lt;iterator&gt;using namespace st
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Demonstrate the front_inserter, back_inserter, ostream_iterator, / and functors. / George F. R
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Demonstrate file streams (fstream) string streams (sstream) / and IO Manipulators / George F.
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Example illustrating Subclassing / ECE3090 / George F. Riley, Georgia Tech, Spring 2009 #inclu
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Demonstrate use of Templates to make a linked list. / ECE3090 - Fall 2004 / George F. Riley, G
Georgia Tech - ECE - 3090
C+ : Documentation : C+ Language Tutorial : TemplatesSearch:SearchTemplatesFunction templatesFunction templates are special functions that can operate with generic types. Thisallows us to create a function template whose functionality can be adapted
Georgia Tech - ECE - 3090
Skip to content. Skip to navigationSearch SiteSearchAdvanced SearchTechnology Services OrganizationTechnology Services OrganizationSections Inside TSO Staff Listing Enterprise Systems Support Operations Projects, Licensing &amp; Asset Mgmt Researc
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47/ 2D FFT Using threads / George F. Riley, Georgia Tech, Fall 2009 #include &lt;iostream&gt; #include &quot;pthread.h&quot; #include &quot;math.h
Georgia Tech - ECE - 3090
/ Demonstrate the use of the Standard Template Library &quot;vector&quot; class. / and associated iterators, and templated subroutines / George F. Riley, ECE3090 Georgia Tech, Fall 2009 #include #include #include #include &lt;iostream&gt; &lt;vector&gt; &lt;algorithm&gt; &lt;iterator&gt;
Georgia Tech - ECE - 3090
/ Demonstrate the use of the Standard Template Library &quot;vector&quot; class. / George F. Riley, ECE3090 Georgia Tech, Fall 2009 / A vector is a variable length array. It starts out as &quot;zero&quot; length / and grows or shrinks as needed. Further, the vector is a arra
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Demonstrate the use of the Standard Template Library &quot;vector&quot; class. / and associated iterator
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Demonstrate the use of the Standard Template Library &quot;vector&quot; class. / George F. Riley, ECE309
Georgia Tech - ECE - 3090
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56/ Example illustrating Subclassing with virtual functions / ECE3090 / George F. Riley, Georgia T
Georgia Tech - ECE - 3090
C+SearchSearch:InformationGeneral information about the C+programming language, including nontechnical documents and descriptions:cplusplus.com Description of the C+ language History of the C+ language F.A.Q., Frequently Asked QuestionsInformati
Palm Beach Community College - HEALTH - HSC 2100
Brooke Sparks16th April 2012HSC2130T&amp;Th 3:30-4:45Genital human papillomavirus, also known as HPV for short, is the most commonsexually transmitted infection (STI) in the United States. This infection is viral. There are morethan 40 types of HPV that
NYU - ECON - ECON-UA 10
NYU - ECON - ECON-UA 10
NYU - ECON - ECON-UA 10
NYU - ECON - ECON-UA 10
Hartford - MGT - 320
Chapter 11 LocationChapter11LocationTRUE/FALSE1.If the customer must be physically present at the process, location is an important issue.Answer: TrueReference: IntroductionDifficulty: EasyKeywords: location, physical presence, customer2.Two c
Hartford - MGT - 320
11LocationPowerPoint SlidesPowerPointby Jeff HeylbyCopyright 2010 Pearson Education, Inc. Publishing as Prentice Hall.For Operations Management, 9e byFor OperationsKrajewski/Ritzman/Malhotra 2010 Pearson Education201011 1Location DecisionsLo
Hartford - MGT - 320
12Inventory ManagementPowerPoint SlidesPowerPointby Jeff HeylbyCopyright 2010 Pearson Education, Inc. Publishing as Prentice Hall.For Operations Management, 9e byFor OperationsKrajewski/Ritzman/Malhotra 2010 Pearson Education201012 1Inventory
Hartford - MGT - 320
13ForecastingPowerPoint SlidesPowerPointby Jeff HeylbyCopyright 2010 Pearson Education, Inc. Publishing as Prentice Hall.For Operations Management, 9e byFor OperationsKrajewski/Ritzman/Malhotra 2010 Pearson Education201013 1Forecasting Forec
Hartford - MGT - 320
Chapter 7 Constraint ManagementChapter7Constraint ManagementTRUE/FALSE1.A bottleneck is an operation that has the lowest effective capacity of any operation in theprocess.Answer: TrueReference: IntroductionDifficulty: ModerateKeywords: bottlene
Hartford - MGT - 320
Chapter 8 Lean SystemsChapter8Lean SystemsTRUE/FALSE1.Lean systems are operating systems that maximize the value added of each of itsactivities by paring unnecessary resources and delays from them.Answer: TrueReference: IntroductionDifficulty: E
Hartford - MGT - 320
Chapter 9 Supply Chain DesignChapter9Supply Chain DesignTRUE/FALSE1.The purpose of supply chain management is to synchronize a firms processes with thoseof its suppliers and customers.Answer: TrueReference: Supply Chains for Services and Manufact
Hartford - MGT - 320
Chapter 10 Supply Chain IntegrationChapter10Supply Chain IntegrationTRUE/FALSE1.Supply chain integration is the effective coordination of supply chain processes throughthe seamless flow of information to suppliers, but does not include customers, s
Hartford - AC - 321
Weaver General Store, Inc.Student # 1:Student # 2:Instructions1. Using the Chart of Accounts provided, record the transactions in the General Journal. Do not add new accounts.2. Post the General Journal entries to the General Ledger.3. Prepare the U
NYU - SOCIAL WOR - 101
AxisIisreservedforclinicaldisordersanddevelopmentalandlearning disorders.DisordersthatmaybepresentonAxisIinclude:PanicDisorderGeneralizedAnxietyDisorderSocialPhobiaObsessiveCompulsiveDisorderPosttraumaticStressDisorderSpecificPhobiaAxisIIisforpers
Lovely Professional University - BUISENESS - mgt 511
CAPITALMARKETCAPITAL MARKETPROLOGUEPROLOGUECapital markets are a sub-part of the financialsystem. Conceptually, the financial systemincludes a complex of institutions andmechanism which affects the generation ofsavings and their transfers to thos