Sample of Drawing Line Algorithms - SOL.pptx

MatheusCardosoSantos1 10 views 10 slides Mar 09, 2025
Slide 1
Slide 1 of 10
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10

About This Presentation

Graphics - Line Drawing Samples


Slide Content

Computer Graphics B. Bartlett, M. Santos D2-037 Main Building. ben.bartlett @ul.ie [email protected] Spring 2025 CS4815 1 Computer Graphics

CS4815 2 Examples - DDA L1 = p(0,0) ; q(2,10) L2 = p(10,7) ; q(2,4) ----------------------------        

CS4815 3 Which pixels? L1: (0,0) (2,10) Sampling in   1 2 1 2 3 4 3 4 5 6 7 8 9 10   1 1 5 2 2 10 1 1 5 2 2 10  

CS4815 4 Which pixels? L1: (0,0) (2,10) Sampling in   1 2 1 2 3 4 3 4 5 6 7 8 9 10   1 0.2 1 2 0.4 2 3 0.6 3 4 0.8 4 5 1 5 6 1.2 6 7 1.4 7 8 1.6 8 9 1.8 9 10 2 10 1 0.2 1 2 0.4 2 3 0.6 3 4 0.8 4 5 1 5 6 1.2 6 7 1.4 7 8 1.6 8 9 1.8 9 10 2 10  

CS4815 5 Which pixels? L2: (10,7) (2,4) Sampling in   2 1 2 3 4 5 6 3 4 5 6 7 8 9 10   2 4 1 3 4.375 2 4 4.75 3 5 5.125 4 6 5.5 5 7 5.875 6 8 6.25 7 9 6.625 8 10 7 2 4 1 3 4.375 2 4 4.75 3 5 5.125 4 6 5.5 5 7 5.875 6 8 6.25 7 9 6.625 8 10 7   7 8 9 10

CS4815 6 Examples - Bresenham’s   L1 = p(0,0) ; q(2,10) L2 = p(10,7) ; q(2,4)

CS4815 7 Which pixels? L2: (10,7) (2,4) Sampling in   2 1 2 3 4 5 6 3 4 5 6 7 8 9 10   2 4 -2 1 3 4 4 2 4 5 -6 3 5 5 4 6 6 -10 5 7 6 -4 6 8 6 2 7 9 7 -8 8 10 7 2 4 -2 1 3 4 4 2 4 5 -6 3 5 5 4 6 6 -10 5 7 6 -4 6 8 6 2 7 9 7 -8 8 10 7 7 8 9 10 Sampling in Positive Slope  

CS4815 8 Examples - Bresenham’s L3 = p(-4,7) ; q(-2,-4) L4 = p(5,2) ; q(11,4) L5 = p(6,12) ; q(14,5)  

CS4815 9 Which pixels? L5: (6,12) (14,5) Sampling in   2 6 3 4 7 8 9 10 5 6 7 8 9 10 11 12   * 6 -12 6 1 7 -11 4 2 8 -10 2 3 9 -9 4 10 -8 -2 5 11 -8 12 6 12 -7 10 7 13 -6 8 8 14 -5 6 -12 6 1 7 -11 4 2 8 -10 2 3 9 -9 4 10 -8 -2 5 11 -8 12 6 12 -7 10 7 13 -6 8 8 14 -5 11 12 13 14 Sampling in Negative Slope Swap sign for calculations L5: (6,-12) (14,-5)   (*) real value is equal to - *  

CS4815 10 Which pixels? L3: (-4,7) (-2,-4) -3 -1 -2 -1 1 2 3 1 2 3 4 5 6 7   * ** -4 2 -7 1 -3 2 -3 2 -2 2 1 3 -1 3 -17 4 3 -13 5 1 3 -9 6 2 3 -5 7 3 3 -1 8 4 3 3 9 5 4 -15 10 6 4 -11 11 7 4 -4 2 -7 1 -3 2 -3 2 -2 2 1 3 -1 3 -17 4 3 -13 5 1 3 -9 6 2 3 -5 7 3 3 -1 8 4 3 3 9 5 4 -15 10 6 4 -11 11 7 4 4 5 6 7 Sampling in Swap for calculations L3: (7,-4) (-4,-2) Since (-4 < 7), rearrange: L3: (-4,-2)(7,-4) Negative Slope Swap sign for calculations L3: (-4,2) (7,4)   (*) true value is equal to - ** (**) true value is equal to *   -2 -3 -4 -4
Tags