Enviar pesquisa
Carregar
Bresenham derivation
•
1 gostou
•
1,068 visualizações
Kumar
Seguir
derivation
Leia menos
Leia mais
Educação
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 3
Baixar agora
Baixar para ler offline
Recomendados
Bresenham circles and polygons derication
Bresenham circles and polygons derication
Kumar
Graphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygons
Thirunavukarasu Mani
bresenham circles and polygons in computer graphics(Computer graphics tutorials)
bresenham circles and polygons in computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
Bresenham Line Drawing Algorithm
Bresenham Line Drawing Algorithm
Mahesh Kodituwakku
Lab lecture 1 line_algo
Lab lecture 1 line_algo
simpleok
Circle drawing algo.
Circle drawing algo.
Mohd Arif
Chapter 3 Output Primitives
Chapter 3 Output Primitives
PrathimaBaliga
Mid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer Graphics
Drishti Bhalla
Recomendados
Bresenham circles and polygons derication
Bresenham circles and polygons derication
Kumar
Graphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygons
Thirunavukarasu Mani
bresenham circles and polygons in computer graphics(Computer graphics tutorials)
bresenham circles and polygons in computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
Bresenham Line Drawing Algorithm
Bresenham Line Drawing Algorithm
Mahesh Kodituwakku
Lab lecture 1 line_algo
Lab lecture 1 line_algo
simpleok
Circle drawing algo.
Circle drawing algo.
Mohd Arif
Chapter 3 Output Primitives
Chapter 3 Output Primitives
PrathimaBaliga
Mid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer Graphics
Drishti Bhalla
Computer Graphics
Computer Graphics
Sneha Chopra
Cs580
Cs580
Chellamuthu K
Bresenhamcircle derivation
Bresenhamcircle derivation
Mazharul Islam
Graphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygons
Ketan Jani
DDA algorithm
DDA algorithm
Yash Patel
Line drawing algo.
Line drawing algo.
Mohd Arif
Dda algorithm
Dda algorithm
Mani Kanth
Output primitives in Computer Graphics
Output primitives in Computer Graphics
Kamal Acharya
Bresenham circle
Bresenham circle
Taher Barodawala
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniques
Ankit Garg
Dda line-algorithm
Dda line-algorithm
Praveen Kumar
Lines and curves algorithms
Lines and curves algorithms
Mohammad Sadiq
Bresenham circlesandpolygons
Bresenham circlesandpolygons
aa11bb11
Dda algo notes
Dda algo notes
shreeja asopa
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Saikrishna Tanguturu
Computer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithm
Ruchi Maurya
Circle generation algorithm
Circle generation algorithm
Ankit Garg
BRESENHAM’S LINE DRAWING ALGORITHM
BRESENHAM’S LINE DRAWING ALGORITHM
St Mary's College,Thrissur,Kerala
Dda line algorithm presentatiion
Dda line algorithm presentatiion
MuhammadHamza401
Lect3cg2011
Lect3cg2011
ishusharma6098
Computer graphics LINE DRAWING algorithm.pptx
Computer graphics LINE DRAWING algorithm.pptx
R S Anu Prabha
Bresenham's line algo.
Bresenham's line algo.
Mohd Arif
Mais conteúdo relacionado
Mais procurados
Computer Graphics
Computer Graphics
Sneha Chopra
Cs580
Cs580
Chellamuthu K
Bresenhamcircle derivation
Bresenhamcircle derivation
Mazharul Islam
Graphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygons
Ketan Jani
DDA algorithm
DDA algorithm
Yash Patel
Line drawing algo.
Line drawing algo.
Mohd Arif
Dda algorithm
Dda algorithm
Mani Kanth
Output primitives in Computer Graphics
Output primitives in Computer Graphics
Kamal Acharya
Bresenham circle
Bresenham circle
Taher Barodawala
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniques
Ankit Garg
Dda line-algorithm
Dda line-algorithm
Praveen Kumar
Lines and curves algorithms
Lines and curves algorithms
Mohammad Sadiq
Bresenham circlesandpolygons
Bresenham circlesandpolygons
aa11bb11
Dda algo notes
Dda algo notes
shreeja asopa
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Saikrishna Tanguturu
Computer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithm
Ruchi Maurya
Circle generation algorithm
Circle generation algorithm
Ankit Garg
BRESENHAM’S LINE DRAWING ALGORITHM
BRESENHAM’S LINE DRAWING ALGORITHM
St Mary's College,Thrissur,Kerala
Dda line algorithm presentatiion
Dda line algorithm presentatiion
MuhammadHamza401
Lect3cg2011
Lect3cg2011
ishusharma6098
Mais procurados
(20)
Computer Graphics
Computer Graphics
Cs580
Cs580
Bresenhamcircle derivation
Bresenhamcircle derivation
Graphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygons
DDA algorithm
DDA algorithm
Line drawing algo.
Line drawing algo.
Dda algorithm
Dda algorithm
Output primitives in Computer Graphics
Output primitives in Computer Graphics
Bresenham circle
Bresenham circle
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniques
Dda line-algorithm
Dda line-algorithm
Lines and curves algorithms
Lines and curves algorithms
Bresenham circlesandpolygons
Bresenham circlesandpolygons
Dda algo notes
Dda algo notes
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithm
Circle generation algorithm
Circle generation algorithm
BRESENHAM’S LINE DRAWING ALGORITHM
BRESENHAM’S LINE DRAWING ALGORITHM
Dda line algorithm presentatiion
Dda line algorithm presentatiion
Lect3cg2011
Lect3cg2011
Semelhante a Bresenham derivation
Computer graphics LINE DRAWING algorithm.pptx
Computer graphics LINE DRAWING algorithm.pptx
R S Anu Prabha
Bresenham's line algo.
Bresenham's line algo.
Mohd Arif
Computer Aided Manufacturing Design
Computer Aided Manufacturing Design
V Tripathi
Tugas akhir matematika kelompok 1
Tugas akhir matematika kelompok 1
Debora Elluisa Manurung
Lab lecture 2 bresenham
Lab lecture 2 bresenham
simpleok
Output Primitive and Brenshamas Line.pptx
Output Primitive and Brenshamas Line.pptx
NaveenaKarthik3
Line circle draw
Line circle draw
Praveen Kumar
Spm add-maths-formula-list-form4-091022090639-phpapp01
Spm add-maths-formula-list-form4-091022090639-phpapp01
Nur Kamila
Additional Mathematics form 4 (formula)
Additional Mathematics form 4 (formula)
Fatini Adnan
Spm add-maths-formula-list-form4-091022090639-phpapp01
Spm add-maths-formula-list-form4-091022090639-phpapp01
Asad Bukhari
Open GL T0074 56 sm4
Open GL T0074 56 sm4
Roziq Bahtiar
C2 st lecture 6 handout
C2 st lecture 6 handout
fatima d
Integration
Integration
SharingIsCaring1000
Ellipses drawing algo.
Ellipses drawing algo.
Mohd Arif
Maths 301 key_sem_1_2009_2010
Maths 301 key_sem_1_2009_2010
Yanbu Industrial College
Mathematics 8 Linear Functions
Mathematics 8 Linear Functions
Juan Miguel Palero
Bresenhams
Bresenhams
Dharmendra Gupta
Module 1 linear functions
Module 1 linear functions
dionesioable
Calculus Final Exam
Calculus Final Exam
Kuan-Lun Wang
1.1_The_Definite_Integral.pdf odjoqwddoio
1.1_The_Definite_Integral.pdf odjoqwddoio
NoorYassinHJamel
Semelhante a Bresenham derivation
(20)
Computer graphics LINE DRAWING algorithm.pptx
Computer graphics LINE DRAWING algorithm.pptx
Bresenham's line algo.
Bresenham's line algo.
Computer Aided Manufacturing Design
Computer Aided Manufacturing Design
Tugas akhir matematika kelompok 1
Tugas akhir matematika kelompok 1
Lab lecture 2 bresenham
Lab lecture 2 bresenham
Output Primitive and Brenshamas Line.pptx
Output Primitive and Brenshamas Line.pptx
Line circle draw
Line circle draw
Spm add-maths-formula-list-form4-091022090639-phpapp01
Spm add-maths-formula-list-form4-091022090639-phpapp01
Additional Mathematics form 4 (formula)
Additional Mathematics form 4 (formula)
Spm add-maths-formula-list-form4-091022090639-phpapp01
Spm add-maths-formula-list-form4-091022090639-phpapp01
Open GL T0074 56 sm4
Open GL T0074 56 sm4
C2 st lecture 6 handout
C2 st lecture 6 handout
Integration
Integration
Ellipses drawing algo.
Ellipses drawing algo.
Maths 301 key_sem_1_2009_2010
Maths 301 key_sem_1_2009_2010
Mathematics 8 Linear Functions
Mathematics 8 Linear Functions
Bresenhams
Bresenhams
Module 1 linear functions
Module 1 linear functions
Calculus Final Exam
Calculus Final Exam
1.1_The_Definite_Integral.pdf odjoqwddoio
1.1_The_Definite_Integral.pdf odjoqwddoio
Mais de Kumar
Graphics devices
Graphics devices
Kumar
Fill area algorithms
Fill area algorithms
Kumar
region-filling
region-filling
Kumar
Introductionto xslt
Introductionto xslt
Kumar
Extracting data from xml
Extracting data from xml
Kumar
Xml basics
Xml basics
Kumar
XML Schema
XML Schema
Kumar
Publishing xml
Publishing xml
Kumar
DTD
DTD
Kumar
Applying xml
Applying xml
Kumar
Introduction to XML
Introduction to XML
Kumar
How to deploy a j2ee application
How to deploy a j2ee application
Kumar
JNDI, JMS, JPA, XML
JNDI, JMS, JPA, XML
Kumar
EJB Fundmentals
EJB Fundmentals
Kumar
JSP and struts programming
JSP and struts programming
Kumar
java servlet and servlet programming
java servlet and servlet programming
Kumar
Introduction to JDBC and JDBC Drivers
Introduction to JDBC and JDBC Drivers
Kumar
Introduction to J2EE
Introduction to J2EE
Kumar
Android tutorial (2)
Android tutorial (2)
Kumar
Android structure
Android structure
Kumar
Mais de Kumar
(20)
Graphics devices
Graphics devices
Fill area algorithms
Fill area algorithms
region-filling
region-filling
Introductionto xslt
Introductionto xslt
Extracting data from xml
Extracting data from xml
Xml basics
Xml basics
XML Schema
XML Schema
Publishing xml
Publishing xml
DTD
DTD
Applying xml
Applying xml
Introduction to XML
Introduction to XML
How to deploy a j2ee application
How to deploy a j2ee application
JNDI, JMS, JPA, XML
JNDI, JMS, JPA, XML
EJB Fundmentals
EJB Fundmentals
JSP and struts programming
JSP and struts programming
java servlet and servlet programming
java servlet and servlet programming
Introduction to JDBC and JDBC Drivers
Introduction to JDBC and JDBC Drivers
Introduction to J2EE
Introduction to J2EE
Android tutorial (2)
Android tutorial (2)
Android structure
Android structure
Último
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
aurabinda banchhor
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
Humphrey A Beña
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
JojoEDelaCruz
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
Celine George
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
mary850239
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
Rosabel UA
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
BabyAnnMotar
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
VanesaIglesias10
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
Mark Reed
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
mary850239
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
JOYLYNSAMANIEGO
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Celine George
Expanded definition: technical and operational
Expanded definition: technical and operational
ssuser3e220a
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
Celine George
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
Anupkumar Sharma
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Jemuel Francisco
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
Nguyen Thanh Tu Collection
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
MiaBumagat1
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
Seán Kennedy
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
Patidar M
Último
(20)
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Expanded definition: technical and operational
Expanded definition: technical and operational
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
Bresenham derivation
1.
Appendix: Derivation of
Bresenham’s line algorithm © E Claridge, School of Computer Science, The University of Birmingham DERIVATION OF THE BRESENHAM’S LINE ALGORITHM Assumptions: ● input: line endpoints at (X1,Y1) and (X2, Y2) ● X1 < X2 ● line slope ≤ 45o , i.e. 0 < m ≤ 1 ● x coordinate is incremented in steps of 1, y coordinate is computed ● generic line equation: y = mx + b x x +1i i y i y +1i y = mx + b y d1 d2 Derivation Assume that we already have a location of pixel ( xi, yi) and have plotted it. The question is, what is the location of the next pixel. Geometric location of the line at x-coordinate xi+1 = xi + 1 is: y = m(xi + 1 ) + b (1) where: m = ∆y / ∆x (slope) (2) b – intercept ∆x = X2 – X1 (from the assumption above that X1 < X2 ) (3) ∆y = Y2 – Y1 Define: d1 = y – yi = m(xi + 1 ) + b - yi d2 = ( yi + 1 ) - y = yi + 1 - m(xi + 1 ) - b Calculate: d1 – d2 = m(xi + 1 ) + b - yi - yi – 1 + m(xi + 1 ) + b = 2m(xi + 1 ) – 2yi + 2b – 1 (4) if d1 – d2 < 0 then yi+1 ← yi (5) if d1 – d2 > 0 then yi+1 ← yi + 1 (6) We want integer calculations in the loop, but m is not an integer. Looking at definition of m (m = ∆y / ∆x) we see that if we multiply m by ∆x, we shall remove the denominator and hence the floating point number.
2.
Appendix: Derivation of
Bresenham’s line algorithm © E Claridge, School of Computer Science, The University of Birmingham For this purpose, let us multiply the difference ( d1 - d2 ) by ∆x and call it pi: pi = ∆x( d1 – d2) The sign of pi is the same as the sign of d1 – d2, because of the assumption (3). Expand pi: pi = ∆x( d1 – d2) = ∆x[ 2m(xi + 1 ) – 2yi + 2b – 1 ] from (4) = ∆x[ 2 ⋅ (∆y / ∆x ) ⋅ (xi + 1 ) – 2yi + 2b – 1 ] from (2) = 2⋅∆y⋅ (xi + 1 ) – 2⋅∆x⋅yi + 2⋅∆x⋅b – ∆x result of multiplication by ∆x = 2⋅∆y⋅xi + 2⋅∆y – 2⋅∆x⋅yi + 2⋅∆x⋅b – ∆x = 2⋅∆y⋅xi– 2⋅∆x⋅yi + 2⋅∆y + 2⋅∆x⋅b – ∆x (7) Note that the underlined part is constant (it does not change during iteration), we call it c, i.e. c = 2⋅∆y + 2⋅∆x⋅b – ∆x Hence we can write an expression for pi as: pi = 2⋅∆y⋅xi– 2⋅∆x⋅yi + c (8) Because the sign of pi is the same as the sign of d1 – d2, we could use it inside the loop to decide whether to select pixel at (xi + 1, yi ) or at (xi + 1, yi +1). Note that the loop will only include integer arithmetic. There are now 6 multiplications, two additions and one selection in each turn of the loop. However, we can do better than this, by defining pi recursively. pi+1 = 2⋅∆y⋅xi+1– 2⋅∆x⋅yi+1 + c from (8) pi+1 – pi = 2⋅∆y⋅xi+1– 2⋅∆x⋅yi+1 + c - (2⋅∆y⋅xi – 2⋅∆x⋅yi + c ) = 2∆y ⋅ (xi+1 – xi) – 2∆x ⋅ (yi+1 – yi) xi+1 – xi = 1 always pi+1 – pi = 2∆y – 2∆x ⋅ (yi+1 – yi) Recursive definition for pi: pi+1 = pi + 2∆y – 2∆x ⋅ (yi+1 – yi) If you now recall the way we construct the line pixel by pixel, you will realise that the underlined expression: yi+1 – yi can be either 0 ( when the next pixel is plotted at the same y- coordinate, i.e. d1 – d2 < 0 from (5)); or 1 ( when the next pixel is plotted at the next y- coordinate, i.e. d1 – d2 > 0 from (6)). Therefore the final recursive definition for pi will be based on choice, as follows (remember that the sign of pi is the same as the sign of d1 – d2):
3.
Appendix: Derivation of
Bresenham’s line algorithm © E Claridge, School of Computer Science, The University of Birmingham if pi < 0, pi+1 = pi + 2∆y because 2∆x ⋅ (yi+1 – yi) = 0 if pi > 0, pi+1 = pi + 2∆y – 2∆x because (yi+1 – yi) = 1 At this stage the basic algorithm is defined. We only need to calculate the initial value for parameter po. pi = 2⋅∆y⋅xi– 2⋅∆x⋅yi + 2⋅∆y + 2⋅∆x⋅b – ∆x from (7) p0 = 2⋅∆y⋅x0– 2⋅∆x⋅y0 + 2⋅∆y + 2∆x⋅b – ∆x (9) For the initial point on the line: y0 = mx0 + b therefore b = y0 – (∆y/∆x) ⋅ x0 Substituting the above for b in (9)we get: p0 = 2⋅∆y⋅x0– 2⋅∆x⋅y0 + 2⋅∆y + 2∆x⋅ [ y0 – (∆y/∆x) ⋅ x0 ] – ∆x = 2⋅∆y⋅x0 – 2⋅∆x⋅y0 + 2⋅∆y + 2∆x⋅y0 – 2∆x⋅ (∆y/∆x) ⋅ x0 – ∆x simplify = 2⋅∆y⋅x0 – 2⋅∆x⋅y0 + 2⋅∆y + 2∆x⋅y0 – 2∆y⋅x0 – ∆x regroup = 2⋅∆y⋅x0 – 2∆y⋅x0 – 2⋅∆x⋅y0 + 2∆x⋅y0 + 2⋅∆y – ∆x simplify = 2⋅∆y – ∆x We can now write an outline of the complete algorithm. Algorithm 1. Input line endpoints, (X1,Y1) and (X2, Y2) 2. Calculate constants: ∆x = X2 – X1 ∆y = Y2 – Y1 2∆y 2∆y – ∆x 3. Assign value to the starting parameters: k = 0 p0 = 2∆y – ∆x 4. Plot the pixel at ((X1,Y1) 5. For each integer x-coordinate, xk, along the line if pk < 0 plot pixel at ( xk + 1, yk ) pk+1 = pk + 2∆y (note that 2∆y is a pre-computed constant) else plot pixel at ( xk + 1, yk + 1 ) pk+1 = pk + 2∆y – 2∆x (note that 2∆y – 2∆x is a pre-computed constant) increment k while xk < X2
Baixar agora