SlideShare a Scribd company logo
 For |m|<1
1. Input 2 line end points and store the left end point
in (x0,y0).
2. Load (x0,y0) into the frame buffer to plot the first
end point.
3. Calculate constants ∆x, ∆y, and 2∆y - 2∆x and 2∆y
and obtain the storing value for the decision
parameter as : P0 = 2∆y - ∆x.
4. At each xk along the line, starting at k = 0, do the
following test: if pk < 0, the next point to plot is
(xk+1, yk) and pk+1 = pk + 2∆y else, the next point to
plot is (xk+1, yk+1) and pk+1 = pk + 2∆y - 2∆x
5. Repeat step 4 ∆x times.
 Suppose we have the line with the 2 following end
points (20,10) and (30,18) use line drawing algorithm
to draw this line.
m=∆y / ∆x = 8/10 < 1.
Initial point : (20,10)
∆x = 10
∆y = 8
2∆y - 2∆x = -4
2∆y = 16
Initial decision parameter P0 = 2∆y - ∆x =16 – 10 = 6
(30,18)
(20,10)
k pk (xk+1,yk+1)
0 6 (21,11)
1 6-4 = 2 (22,12)
2 18-20 = -2 (23,12)
3 -2+16 = 14 (24,13)
4 14-4 = 10 (25,14)
5 6 (26,15)
6 2 (27,16)
7 -2 (28,16)
8 14 (29,17)
9 10 (30,18)
 For |m|>=1 Interchange the values of x and y (y is
always increasing in the table and the decision
parameter become :
P0 = 2∆x - ∆y and pk+1 = pk + 2∆x - 2∆y or pk + 2∆x .
 Suppose we have the line with the 2 following end
points (1,3) and (7,12) use line drawing algorithm to
draw this line.
m=∆y / ∆x = 9/6 > 1.
Initial point : (1,3)
∆x = 6
∆y = 9
2∆x - 2∆y = -6
2∆x = 12
Initial decision parameter P0 = 2∆x - ∆y = 3
(7,2)
(1,3)
k pk (xk+1,yk+1)
0 3 (2,4)
1 (3+12-18) = -3 (2,5)
2 9 (3,6)
3 3 (4,7)
4 -3 (4,8)
5 9 (5,9)
6 3 (6,10)
7 -3 (6,11)
8 9 (7,12)
 Suppose we have the line with the 2 following end
points (5,7) and (9,19) use line drawing algorithm to
draw this line.
m=∆y / ∆x = 12/4 > 1.
Initial point : (5,7)
∆x = 4
∆y = 12
2∆x - 2∆y = -16
2∆x = 8
Initial decision parameter P0 = 2∆x - ∆y = -4
(9,19)
(5,7)
k pk (xk+1,yk+1)
0 -4 (5,8)
1 4 (6,9)
2 -12 (6,10)
3 -4 (6,11)
4 4 (7,12)
5 -12 (7,13)
6 -4 (7,14)
7 4 (8,15)
8 -12 (8,16)
9 -4 (8,17)
10 4 (9,18)
11 -12 (9,19)
 Suppose we have the line with the 2 following end
points (2,6) and (8,7) use line drawing algorithm to
draw this line.
m=∆y / ∆x = 1/6 < 1.
Initial point : (2,6)
∆x = 6
∆y = 1
2∆y - 2∆x = -10
2∆y = 2
Initial decision parameter P0 = 2∆y - ∆x = -4
(8,7)
(2,6)
k pk (xk+1,yk+1)
0 -4 (3,6)
1 -2 (4,6)
2 0 (5,7)
3 -10 (6,7)
4 -8 (7,7)
5 -6 (8,7)
1. Input radius r and circle center (xi,yi) and obtain
the first point on the circumference of the circle
centered on the origin as (0,r).
2. Calculate the initial value of decision parameter
as p0 = 5/4 – r (if its integer 1-r).
3. At each xk position starting at k=0, perform the
following test: If pk < 0 then the next point on
circle centered on (0,0) is (xk+1,yk) and pk+1 =
pk+2xk+1+1 else the next point along the circle
centered on (0,0) is (xk+1,yk-1) and pk+1 =
pk+2xk+1+1-2yk+1
4. Repeat step 3 until x>=y.
 Given r=10 use midpoint circle algorithm to draw
circle.
Initial point : (0,10)
Initial decision parameter P0 = 1-r = -9
k pk (xk+1,yk+1) 2xk+1 2yk+1
0 -9 (1,10) 2 20
1 -6 (2,10) 4 20
2 -1 (3,10) 6 20
3 6 (4,9) 8 18
4 -3 (5,9) 10 18
5 8 (6,8) 12 16
6 5 (7,7) Stop 14 14
 Given r=14 use midpoint circle algorithm to draw
circle.
Initial point : (0,14) P0 = 1-r = -13
k pk (xk+1,yk+1) 2xk+1 2yk+1
0 -13 (1,14) 2 28
1 -10 (2,14) 4 28
2 -5 (3,14) 6 28
3 2 (4,13) 8 26
4 -15 (5,13) 10 26
5 -4 (6,13) 12 26
6 9 (7,12) 14 24
7 0 (8,11) 16 22
8 -5 (9,11) 18 22
9 14 (10,10)
1. Input rx, ry and ellipse center (xc,yc) and obtain the
first point on an ellipse centered (0,0) on the origins
as (x0,y0) = (0,ry).
2. Calculate the initial value of decision parameter in
region 1 as p10 = ry
2 - rx
2 ry + ¼ rx
2.
3. At each xk position in region 1 starting at k=0,
perform the following test: If p1k < 0 then the next
point along the ellipse centered on (0,0) is (xk+1,yk)
and p1k+1 = p1k+2ry
2xk+1+ry
2 else the next point along
the ellipse centered on (0,0) is (xk+1,yk-1) and p1k+1 =
p1k+2ry
2xk+1+ry
2-2rx
2yk+1.
4. Repeat the steps for region 1 until 2ry
2 xk+1>= 2rx
2
yk+1
4. Calculate the initial value of decision parameter
in region 2 using the last point (x0,y0)
calculated in region 1 as p20 = ry
2 (x0+½)2+rx
2 (y0-
1)2-rx
2ry
2
5. At each yk position in region 2 starting at k=0,
perform the following test: If p2k >= 0 then the
next point along the ellipse centered on (0,0) is
(xk,yk-1) and p2k+1 = p2k-2rx
2yk+1+rx
2 else the next
point along the ellipse centered on (0,0) is
(xk+1,yk+1) and p2k+1 = p2k+2ry
2xk+1-2rx
2yk+1+rx
2.
(Note: Use the same increment value for x and y
in region 1.)
6. Repeat the steps for region 2 until yk+1=0.
 Given ellipse parameter with rx=8 and ry=6 use
midpoint ellipse drawing to draw an ellipse.
Initial point for region 1 (0,ry)=(0,6).
2ry
2x= 0 (with increment value 2ry
2 = 2(6)2=72)
2rx
2y= 2rx
2ry= 2(8)2(6) (with increment value
–rx
2=-2(8)2=-128)
The initial decision parameter for region 1
p10 = ry
2 - rx
2 ry + ¼ rx
2 =(6)2 - (8)2(6) + ¼(8)2 =-332
k pk (xk+1,yk+1) 2ry
2 xk+1 2rx
2 yk+1
0 -332 (1,6) 72 768
1 -224 (2,6) 144 768
2 -44 (3,6) 216 768
3 208 (4,5) 288 640
4 -108 (5,5) 360 640
5 288 (6,4) 432 512
6 244 (7,3) 504 384
 Stop since 2ry
2 xk+1 > 2rx
2 yk+1
We now move to region 2
Initial point for region 2 (x0,y0)=(7,3).
The initial decision parameter for region 2
p20 = ry
2 (x0+½)2+rx
2 (y0-1)2-rx
2ry
2
=36(7.5)2+64(2)2-64*36= -151
k pk (xk+1,yk+1) 2ry
2 xk+1 2rx
2 yk+1
0 -151 (8,2) 576 256
1 233 (8,1) 576 128
2 745 (8,0) 576 0
 Given ellipse parameter with rx=8 and ry=10 use
midpoint ellipse drawing to draw an ellipse.
Initial point for region 1 (0,ry)=(0,10).
2ry
2x= 0 (with increment value 2ry
2 = 2(10)2=200)
2rx
2y= 2rx
2ry= 2(8)2(10) (with increment value
–rx
2=-2(8)2=-128)
The initial decision parameter for region 1
p10 = ry
2 - rx
2 ry + ¼ rx
2
=(10)2 - (8)2(10) + ¼(8)2 =-524
k pk (xk+1,yk+1) 2ry
2 xk+1 2rx
2 yk+1
0 -524 (1,10) 200 1280
1 -224 (2,10) 400 1280
2 276 (3,9) 600 1152
3 -176 (4,9) 800 1152
4 724 (5,8) 1000 1024
5 800 (6,7) 1200 896
We now move to region 2
Initial point for region 2 (x0,y0)=(6,7).
The initial decision parameter for region 2
p20 = ry
2 (x0+½)2+rx
2 (y0-1)2-rx
2ry
2
=100(6.5)2+64(6)2-64*100= 129
k pk (xk+1,yk+1) 2ry
2 xk+1 2rx
2 yk+1
0 129 (6,6) 1200 768
1 -703 (7,5) 1400 640
( ,0) Stop

More Related Content

What's hot

Solve ODE - BVP through the Least Squares Method
Solve ODE - BVP through the Least Squares MethodSolve ODE - BVP through the Least Squares Method
Solve ODE - BVP through the Least Squares Method
Suddhasheel GHOSH, PhD
 
FEM Introduction: Solving ODE-BVP using the Galerkin's Method
FEM Introduction: Solving ODE-BVP using the Galerkin's MethodFEM Introduction: Solving ODE-BVP using the Galerkin's Method
FEM Introduction: Solving ODE-BVP using the Galerkin's Method
Suddhasheel GHOSH, PhD
 
Consolidated.m2-satyabama university
Consolidated.m2-satyabama universityConsolidated.m2-satyabama university
Consolidated.m2-satyabama university
Selvaraj John
 
2.circle
2.circle2.circle
2.circle
SakshiNailwal
 
Point Collocation Method used in the solving of Differential Equations, parti...
Point Collocation Method used in the solving of Differential Equations, parti...Point Collocation Method used in the solving of Differential Equations, parti...
Point Collocation Method used in the solving of Differential Equations, parti...
Suddhasheel GHOSH, PhD
 
[4] num integration
[4] num integration[4] num integration
[4] num integrationikhulsys
 
C7 7.4
C7 7.4C7 7.4
C7 7.4
BGEsp1
 
Leidy rivadeneira deber_1
Leidy rivadeneira deber_1Leidy rivadeneira deber_1
Leidy rivadeneira deber_1
L.R. Rivadeneira
 
Engr 213 midterm 2b sol 2010
Engr 213 midterm 2b sol 2010Engr 213 midterm 2b sol 2010
Engr 213 midterm 2b sol 2010akabaka12
 
Local linear approximation
Local linear approximationLocal linear approximation
Local linear approximation
Tarun Gehlot
 
Amth250 octave matlab some solutions (2)
Amth250 octave matlab some solutions (2)Amth250 octave matlab some solutions (2)
Amth250 octave matlab some solutions (2)asghar123456
 
last lecture in infinite series
last lecture in infinite serieslast lecture in infinite series
last lecture in infinite seriesAlaa Mohammed
 
Question bank Engineering Mathematics- ii
Question bank Engineering Mathematics- ii Question bank Engineering Mathematics- ii
Question bank Engineering Mathematics- ii
Mohammad Imran
 
Interpolation functions
Interpolation functionsInterpolation functions
Interpolation functions
Tarun Gehlot
 
Newton's Backward Interpolation Formula with Example
Newton's Backward Interpolation Formula with ExampleNewton's Backward Interpolation Formula with Example
Newton's Backward Interpolation Formula with Example
MuhammadUsmanIkram2
 
Bahan ajar kalkulus integral
Bahan ajar kalkulus integralBahan ajar kalkulus integral
Bahan ajar kalkulus integral
grand_livina_good
 

What's hot (19)

Solve ODE - BVP through the Least Squares Method
Solve ODE - BVP through the Least Squares MethodSolve ODE - BVP through the Least Squares Method
Solve ODE - BVP through the Least Squares Method
 
FEM Introduction: Solving ODE-BVP using the Galerkin's Method
FEM Introduction: Solving ODE-BVP using the Galerkin's MethodFEM Introduction: Solving ODE-BVP using the Galerkin's Method
FEM Introduction: Solving ODE-BVP using the Galerkin's Method
 
Maths 301 key_sem_1_2009_2010
Maths 301 key_sem_1_2009_2010Maths 301 key_sem_1_2009_2010
Maths 301 key_sem_1_2009_2010
 
Consolidated.m2-satyabama university
Consolidated.m2-satyabama universityConsolidated.m2-satyabama university
Consolidated.m2-satyabama university
 
2.circle
2.circle2.circle
2.circle
 
Point Collocation Method used in the solving of Differential Equations, parti...
Point Collocation Method used in the solving of Differential Equations, parti...Point Collocation Method used in the solving of Differential Equations, parti...
Point Collocation Method used in the solving of Differential Equations, parti...
 
[4] num integration
[4] num integration[4] num integration
[4] num integration
 
Lap lace
Lap laceLap lace
Lap lace
 
C7 7.4
C7 7.4C7 7.4
C7 7.4
 
Leidy rivadeneira deber_1
Leidy rivadeneira deber_1Leidy rivadeneira deber_1
Leidy rivadeneira deber_1
 
Engr 213 midterm 2b sol 2010
Engr 213 midterm 2b sol 2010Engr 213 midterm 2b sol 2010
Engr 213 midterm 2b sol 2010
 
Local linear approximation
Local linear approximationLocal linear approximation
Local linear approximation
 
Amth250 octave matlab some solutions (2)
Amth250 octave matlab some solutions (2)Amth250 octave matlab some solutions (2)
Amth250 octave matlab some solutions (2)
 
last lecture in infinite series
last lecture in infinite serieslast lecture in infinite series
last lecture in infinite series
 
Question bank Engineering Mathematics- ii
Question bank Engineering Mathematics- ii Question bank Engineering Mathematics- ii
Question bank Engineering Mathematics- ii
 
Maths05
Maths05Maths05
Maths05
 
Interpolation functions
Interpolation functionsInterpolation functions
Interpolation functions
 
Newton's Backward Interpolation Formula with Example
Newton's Backward Interpolation Formula with ExampleNewton's Backward Interpolation Formula with Example
Newton's Backward Interpolation Formula with Example
 
Bahan ajar kalkulus integral
Bahan ajar kalkulus integralBahan ajar kalkulus integral
Bahan ajar kalkulus integral
 

Similar to Computer Graphics - lines, Circles and ellipse

Computer graphics lab report with code in cpp
Computer graphics lab report with code in cppComputer graphics lab report with code in cpp
Computer graphics lab report with code in cpp
Alamgir Hossain
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithmsMohammad Sadiq
 
Lec05 circle ellipse
Lec05 circle ellipseLec05 circle ellipse
Lec05 circle ellipse
Maaz Rizwan
 
Unit 3
Unit 3Unit 3
10994479.ppt
10994479.ppt10994479.ppt
10994479.ppt
ALIZAIB KHAN
 
mid point algorithm.pdf
mid point algorithm.pdfmid point algorithm.pdf
mid point algorithm.pdf
MehulMunshi3
 
Computer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptComputer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.ppt
AliZaib71
 
Bressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing AlgorithmBressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing Algorithm
Mrinmoy Dalal
 
Circle algorithm
Circle algorithmCircle algorithm
Circle algorithm
Pooja Dixit
 
Lab lecture 2 bresenham
Lab lecture 2 bresenhamLab lecture 2 bresenham
Lab lecture 2 bresenham
simpleok
 
Output Primitive and Brenshamas Line.pptx
Output Primitive and Brenshamas Line.pptxOutput Primitive and Brenshamas Line.pptx
Output Primitive and Brenshamas Line.pptx
NaveenaKarthik3
 
35182797 additional-mathematics-form-4-and-5-notes
35182797 additional-mathematics-form-4-and-5-notes35182797 additional-mathematics-form-4-and-5-notes
35182797 additional-mathematics-form-4-and-5-notesWendy Pindah
 
Chapter 3 Output Primitives
Chapter 3 Output PrimitivesChapter 3 Output Primitives
Chapter 3 Output Primitives
PrathimaBaliga
 
7. Bresenharms Circle Generation Algo_c8503330f911dd9ec76af8508bc0728d.pptx
7. Bresenharms Circle Generation Algo_c8503330f911dd9ec76af8508bc0728d.pptx7. Bresenharms Circle Generation Algo_c8503330f911dd9ec76af8508bc0728d.pptx
7. Bresenharms Circle Generation Algo_c8503330f911dd9ec76af8508bc0728d.pptx
ghosharkoprabho
 
module 1.pdf
module 1.pdfmodule 1.pdf
module 1.pdf
KimTaehyung188352
 
Computer Graphics Unit 2
Computer Graphics Unit 2Computer Graphics Unit 2
Computer Graphics Unit 2
SanthiNivas
 
Lect4 ellipse
Lect4 ellipseLect4 ellipse
Lect4 ellipse
BCET
 
Rosser's theorem
Rosser's theoremRosser's theorem
Rosser's theorem
Wathna
 
Unit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithmsUnit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithms
Amol Gaikwad
 

Similar to Computer Graphics - lines, Circles and ellipse (20)

Computer graphics lab report with code in cpp
Computer graphics lab report with code in cppComputer graphics lab report with code in cpp
Computer graphics lab report with code in cpp
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithms
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Lec05 circle ellipse
Lec05 circle ellipseLec05 circle ellipse
Lec05 circle ellipse
 
Unit 3
Unit 3Unit 3
Unit 3
 
10994479.ppt
10994479.ppt10994479.ppt
10994479.ppt
 
mid point algorithm.pdf
mid point algorithm.pdfmid point algorithm.pdf
mid point algorithm.pdf
 
Computer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptComputer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.ppt
 
Bressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing AlgorithmBressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing Algorithm
 
Circle algorithm
Circle algorithmCircle algorithm
Circle algorithm
 
Lab lecture 2 bresenham
Lab lecture 2 bresenhamLab lecture 2 bresenham
Lab lecture 2 bresenham
 
Output Primitive and Brenshamas Line.pptx
Output Primitive and Brenshamas Line.pptxOutput Primitive and Brenshamas Line.pptx
Output Primitive and Brenshamas Line.pptx
 
35182797 additional-mathematics-form-4-and-5-notes
35182797 additional-mathematics-form-4-and-5-notes35182797 additional-mathematics-form-4-and-5-notes
35182797 additional-mathematics-form-4-and-5-notes
 
Chapter 3 Output Primitives
Chapter 3 Output PrimitivesChapter 3 Output Primitives
Chapter 3 Output Primitives
 
7. Bresenharms Circle Generation Algo_c8503330f911dd9ec76af8508bc0728d.pptx
7. Bresenharms Circle Generation Algo_c8503330f911dd9ec76af8508bc0728d.pptx7. Bresenharms Circle Generation Algo_c8503330f911dd9ec76af8508bc0728d.pptx
7. Bresenharms Circle Generation Algo_c8503330f911dd9ec76af8508bc0728d.pptx
 
module 1.pdf
module 1.pdfmodule 1.pdf
module 1.pdf
 
Computer Graphics Unit 2
Computer Graphics Unit 2Computer Graphics Unit 2
Computer Graphics Unit 2
 
Lect4 ellipse
Lect4 ellipseLect4 ellipse
Lect4 ellipse
 
Rosser's theorem
Rosser's theoremRosser's theorem
Rosser's theorem
 
Unit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithmsUnit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithms
 

More from Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D

Present Simple and Continuous
Present Simple and ContinuousPresent Simple and Continuous
Present Perfect Simple and Continuous
Present Perfect Simple and ContinuousPresent Perfect Simple and Continuous
Present Perfect Simple and Continuous
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D
 
Past Simple and Continuous
Past Simple and ContinuousPast Simple and Continuous
Obligation and Permission
Obligation and PermissionObligation and Permission
Comparatives and Superlatives
Comparatives and SuperlativesComparatives and Superlatives
Auxiliary verbs
Auxiliary verbsAuxiliary verbs
Adjective ending in ed or ing
Adjective ending in ed or ingAdjective ending in ed or ing
Operations Research - Game Theory
Operations Research - Game TheoryOperations Research - Game Theory
Operations Research - Game Theory
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D
 
Operations Research - Sensitivity Analysis
Operations Research - Sensitivity AnalysisOperations Research - Sensitivity Analysis
Operations Research - Sensitivity Analysis
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D
 
Operations Research - The Dual Simplex Method
Operations Research - The Dual Simplex MethodOperations Research - The Dual Simplex Method
Operations Research - The Dual Simplex Method
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D
 
Operations Research - The Revised Simplex Method
Operations Research - The Revised Simplex MethodOperations Research - The Revised Simplex Method
Operations Research - The Revised Simplex Method
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D
 
Operations Research - The Two Phase Method
Operations Research - The Two Phase MethodOperations Research - The Two Phase Method
Operations Research - The Two Phase Method
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D
 
Operations Research - The Big M Method
Operations Research - The Big M MethodOperations Research - The Big M Method
Operations Research - The Big M Method
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D
 
Operations Research - Simplex Method Tableau
Operations Research - Simplex Method TableauOperations Research - Simplex Method Tableau
Operations Research - Simplex Method Tableau
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D
 
Operations Research - Simplex Method Principles
Operations Research - Simplex Method PrinciplesOperations Research - Simplex Method Principles
Operations Research - Simplex Method Principles
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D
 

More from Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D (20)

Audio
AudioAudio
Audio
 
The Passive
The PassiveThe Passive
The Passive
 
Relative Clauses
Relative ClausesRelative Clauses
Relative Clauses
 
Quantifiers
QuantifiersQuantifiers
Quantifiers
 
Present Simple and Continuous
Present Simple and ContinuousPresent Simple and Continuous
Present Simple and Continuous
 
Present Perfect Simple and Continuous
Present Perfect Simple and ContinuousPresent Perfect Simple and Continuous
Present Perfect Simple and Continuous
 
Prepositions
PrepositionsPrepositions
Prepositions
 
Past Simple and Continuous
Past Simple and ContinuousPast Simple and Continuous
Past Simple and Continuous
 
Obligation and Permission
Obligation and PermissionObligation and Permission
Obligation and Permission
 
Comparatives and Superlatives
Comparatives and SuperlativesComparatives and Superlatives
Comparatives and Superlatives
 
Auxiliary verbs
Auxiliary verbsAuxiliary verbs
Auxiliary verbs
 
Adjective ending in ed or ing
Adjective ending in ed or ingAdjective ending in ed or ing
Adjective ending in ed or ing
 
Operations Research - Game Theory
Operations Research - Game TheoryOperations Research - Game Theory
Operations Research - Game Theory
 
Operations Research - Sensitivity Analysis
Operations Research - Sensitivity AnalysisOperations Research - Sensitivity Analysis
Operations Research - Sensitivity Analysis
 
Operations Research - The Dual Simplex Method
Operations Research - The Dual Simplex MethodOperations Research - The Dual Simplex Method
Operations Research - The Dual Simplex Method
 
Operations Research - The Revised Simplex Method
Operations Research - The Revised Simplex MethodOperations Research - The Revised Simplex Method
Operations Research - The Revised Simplex Method
 
Operations Research - The Two Phase Method
Operations Research - The Two Phase MethodOperations Research - The Two Phase Method
Operations Research - The Two Phase Method
 
Operations Research - The Big M Method
Operations Research - The Big M MethodOperations Research - The Big M Method
Operations Research - The Big M Method
 
Operations Research - Simplex Method Tableau
Operations Research - Simplex Method TableauOperations Research - Simplex Method Tableau
Operations Research - Simplex Method Tableau
 
Operations Research - Simplex Method Principles
Operations Research - Simplex Method PrinciplesOperations Research - Simplex Method Principles
Operations Research - Simplex Method Principles
 

Recently uploaded

Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 

Recently uploaded (20)

Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 

Computer Graphics - lines, Circles and ellipse

  • 1.
  • 2.  For |m|<1 1. Input 2 line end points and store the left end point in (x0,y0). 2. Load (x0,y0) into the frame buffer to plot the first end point. 3. Calculate constants ∆x, ∆y, and 2∆y - 2∆x and 2∆y and obtain the storing value for the decision parameter as : P0 = 2∆y - ∆x. 4. At each xk along the line, starting at k = 0, do the following test: if pk < 0, the next point to plot is (xk+1, yk) and pk+1 = pk + 2∆y else, the next point to plot is (xk+1, yk+1) and pk+1 = pk + 2∆y - 2∆x 5. Repeat step 4 ∆x times.
  • 3.  Suppose we have the line with the 2 following end points (20,10) and (30,18) use line drawing algorithm to draw this line. m=∆y / ∆x = 8/10 < 1. Initial point : (20,10) ∆x = 10 ∆y = 8 2∆y - 2∆x = -4 2∆y = 16 Initial decision parameter P0 = 2∆y - ∆x =16 – 10 = 6 (30,18) (20,10)
  • 4. k pk (xk+1,yk+1) 0 6 (21,11) 1 6-4 = 2 (22,12) 2 18-20 = -2 (23,12) 3 -2+16 = 14 (24,13) 4 14-4 = 10 (25,14) 5 6 (26,15) 6 2 (27,16) 7 -2 (28,16) 8 14 (29,17) 9 10 (30,18)
  • 5.  For |m|>=1 Interchange the values of x and y (y is always increasing in the table and the decision parameter become : P0 = 2∆x - ∆y and pk+1 = pk + 2∆x - 2∆y or pk + 2∆x .
  • 6.  Suppose we have the line with the 2 following end points (1,3) and (7,12) use line drawing algorithm to draw this line. m=∆y / ∆x = 9/6 > 1. Initial point : (1,3) ∆x = 6 ∆y = 9 2∆x - 2∆y = -6 2∆x = 12 Initial decision parameter P0 = 2∆x - ∆y = 3 (7,2) (1,3)
  • 7. k pk (xk+1,yk+1) 0 3 (2,4) 1 (3+12-18) = -3 (2,5) 2 9 (3,6) 3 3 (4,7) 4 -3 (4,8) 5 9 (5,9) 6 3 (6,10) 7 -3 (6,11) 8 9 (7,12)
  • 8.  Suppose we have the line with the 2 following end points (5,7) and (9,19) use line drawing algorithm to draw this line. m=∆y / ∆x = 12/4 > 1. Initial point : (5,7) ∆x = 4 ∆y = 12 2∆x - 2∆y = -16 2∆x = 8 Initial decision parameter P0 = 2∆x - ∆y = -4 (9,19) (5,7)
  • 9. k pk (xk+1,yk+1) 0 -4 (5,8) 1 4 (6,9) 2 -12 (6,10) 3 -4 (6,11) 4 4 (7,12) 5 -12 (7,13) 6 -4 (7,14) 7 4 (8,15) 8 -12 (8,16) 9 -4 (8,17) 10 4 (9,18) 11 -12 (9,19)
  • 10.  Suppose we have the line with the 2 following end points (2,6) and (8,7) use line drawing algorithm to draw this line. m=∆y / ∆x = 1/6 < 1. Initial point : (2,6) ∆x = 6 ∆y = 1 2∆y - 2∆x = -10 2∆y = 2 Initial decision parameter P0 = 2∆y - ∆x = -4 (8,7) (2,6)
  • 11. k pk (xk+1,yk+1) 0 -4 (3,6) 1 -2 (4,6) 2 0 (5,7) 3 -10 (6,7) 4 -8 (7,7) 5 -6 (8,7)
  • 12. 1. Input radius r and circle center (xi,yi) and obtain the first point on the circumference of the circle centered on the origin as (0,r). 2. Calculate the initial value of decision parameter as p0 = 5/4 – r (if its integer 1-r). 3. At each xk position starting at k=0, perform the following test: If pk < 0 then the next point on circle centered on (0,0) is (xk+1,yk) and pk+1 = pk+2xk+1+1 else the next point along the circle centered on (0,0) is (xk+1,yk-1) and pk+1 = pk+2xk+1+1-2yk+1 4. Repeat step 3 until x>=y.
  • 13.  Given r=10 use midpoint circle algorithm to draw circle. Initial point : (0,10) Initial decision parameter P0 = 1-r = -9 k pk (xk+1,yk+1) 2xk+1 2yk+1 0 -9 (1,10) 2 20 1 -6 (2,10) 4 20 2 -1 (3,10) 6 20 3 6 (4,9) 8 18 4 -3 (5,9) 10 18 5 8 (6,8) 12 16 6 5 (7,7) Stop 14 14
  • 14.  Given r=14 use midpoint circle algorithm to draw circle. Initial point : (0,14) P0 = 1-r = -13 k pk (xk+1,yk+1) 2xk+1 2yk+1 0 -13 (1,14) 2 28 1 -10 (2,14) 4 28 2 -5 (3,14) 6 28 3 2 (4,13) 8 26 4 -15 (5,13) 10 26 5 -4 (6,13) 12 26 6 9 (7,12) 14 24 7 0 (8,11) 16 22 8 -5 (9,11) 18 22 9 14 (10,10)
  • 15. 1. Input rx, ry and ellipse center (xc,yc) and obtain the first point on an ellipse centered (0,0) on the origins as (x0,y0) = (0,ry). 2. Calculate the initial value of decision parameter in region 1 as p10 = ry 2 - rx 2 ry + ¼ rx 2. 3. At each xk position in region 1 starting at k=0, perform the following test: If p1k < 0 then the next point along the ellipse centered on (0,0) is (xk+1,yk) and p1k+1 = p1k+2ry 2xk+1+ry 2 else the next point along the ellipse centered on (0,0) is (xk+1,yk-1) and p1k+1 = p1k+2ry 2xk+1+ry 2-2rx 2yk+1. 4. Repeat the steps for region 1 until 2ry 2 xk+1>= 2rx 2 yk+1
  • 16. 4. Calculate the initial value of decision parameter in region 2 using the last point (x0,y0) calculated in region 1 as p20 = ry 2 (x0+½)2+rx 2 (y0- 1)2-rx 2ry 2 5. At each yk position in region 2 starting at k=0, perform the following test: If p2k >= 0 then the next point along the ellipse centered on (0,0) is (xk,yk-1) and p2k+1 = p2k-2rx 2yk+1+rx 2 else the next point along the ellipse centered on (0,0) is (xk+1,yk+1) and p2k+1 = p2k+2ry 2xk+1-2rx 2yk+1+rx 2. (Note: Use the same increment value for x and y in region 1.) 6. Repeat the steps for region 2 until yk+1=0.
  • 17.  Given ellipse parameter with rx=8 and ry=6 use midpoint ellipse drawing to draw an ellipse. Initial point for region 1 (0,ry)=(0,6). 2ry 2x= 0 (with increment value 2ry 2 = 2(6)2=72) 2rx 2y= 2rx 2ry= 2(8)2(6) (with increment value –rx 2=-2(8)2=-128) The initial decision parameter for region 1 p10 = ry 2 - rx 2 ry + ¼ rx 2 =(6)2 - (8)2(6) + ¼(8)2 =-332
  • 18. k pk (xk+1,yk+1) 2ry 2 xk+1 2rx 2 yk+1 0 -332 (1,6) 72 768 1 -224 (2,6) 144 768 2 -44 (3,6) 216 768 3 208 (4,5) 288 640 4 -108 (5,5) 360 640 5 288 (6,4) 432 512 6 244 (7,3) 504 384  Stop since 2ry 2 xk+1 > 2rx 2 yk+1
  • 19. We now move to region 2 Initial point for region 2 (x0,y0)=(7,3). The initial decision parameter for region 2 p20 = ry 2 (x0+½)2+rx 2 (y0-1)2-rx 2ry 2 =36(7.5)2+64(2)2-64*36= -151 k pk (xk+1,yk+1) 2ry 2 xk+1 2rx 2 yk+1 0 -151 (8,2) 576 256 1 233 (8,1) 576 128 2 745 (8,0) 576 0
  • 20.  Given ellipse parameter with rx=8 and ry=10 use midpoint ellipse drawing to draw an ellipse. Initial point for region 1 (0,ry)=(0,10). 2ry 2x= 0 (with increment value 2ry 2 = 2(10)2=200) 2rx 2y= 2rx 2ry= 2(8)2(10) (with increment value –rx 2=-2(8)2=-128) The initial decision parameter for region 1 p10 = ry 2 - rx 2 ry + ¼ rx 2 =(10)2 - (8)2(10) + ¼(8)2 =-524
  • 21. k pk (xk+1,yk+1) 2ry 2 xk+1 2rx 2 yk+1 0 -524 (1,10) 200 1280 1 -224 (2,10) 400 1280 2 276 (3,9) 600 1152 3 -176 (4,9) 800 1152 4 724 (5,8) 1000 1024 5 800 (6,7) 1200 896
  • 22. We now move to region 2 Initial point for region 2 (x0,y0)=(6,7). The initial decision parameter for region 2 p20 = ry 2 (x0+½)2+rx 2 (y0-1)2-rx 2ry 2 =100(6.5)2+64(6)2-64*100= 129 k pk (xk+1,yk+1) 2ry 2 xk+1 2rx 2 yk+1 0 129 (6,6) 1200 768 1 -703 (7,5) 1400 640 ( ,0) Stop