尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
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

Spline representations
Spline representationsSpline representations
Spline representations
Nikhil krishnan
 
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's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Saikrishna Tanguturu
 
2 d viewing computer graphics
2 d viewing computer graphics2 d viewing computer graphics
2 d viewing computer graphics
KALESHWAR KUMAR
 
Video display devices
Video display devicesVideo display devices
Video display devices
Mohd Arif
 
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
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
Kamal Acharya
 
Ellipses drawing algo.
Ellipses drawing algo.Ellipses drawing algo.
Ellipses drawing algo.
Mohd Arif
 
Unit 3
Unit 3Unit 3
Unit 3
ypnrao
 
Halftoning in Computer Graphics
Halftoning  in Computer GraphicsHalftoning  in Computer Graphics
Halftoning in Computer Graphics
University of Potsdam
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
Sanu Philip
 
Computer Graphics: Visible surface detection methods
Computer Graphics: Visible surface detection methodsComputer Graphics: Visible surface detection methods
Computer Graphics: Visible surface detection methods
Joseph Charles
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
nehrurevathy
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping Algorithm
Maruf Abdullah (Rion)
 
Chapter 3 Output Primitives
Chapter 3 Output PrimitivesChapter 3 Output Primitives
Chapter 3 Output Primitives
PrathimaBaliga
 
Window to viewport transformation&amp;matrix representation of homogeneous co...
Window to viewport transformation&amp;matrix representation of homogeneous co...Window to viewport transformation&amp;matrix representation of homogeneous co...
Window to viewport transformation&amp;matrix representation of homogeneous co...
Mani Kanth
 
Bresenham's line algorithm
Bresenham's line algorithmBresenham's line algorithm
Bresenham's line algorithm
Pooja Dixit
 
Composite transformation
Composite transformationComposite transformation
Composite transformation
Pooja Dixit
 
Concept of basic illumination model
Concept of basic illumination modelConcept of basic illumination model
Concept of basic illumination model
Ankit Garg
 
Polygon mesh
Polygon  meshPolygon  mesh
Polygon mesh
Farah M. Altufaili
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
Selvakumar Gna
 

What's hot (20)

Spline representations
Spline representationsSpline representations
Spline representations
 
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's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
 
2 d viewing computer graphics
2 d viewing computer graphics2 d viewing computer graphics
2 d viewing computer graphics
 
Video display devices
Video display devicesVideo display devices
Video display devices
 
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
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 
Ellipses drawing algo.
Ellipses drawing algo.Ellipses drawing algo.
Ellipses drawing algo.
 
Unit 3
Unit 3Unit 3
Unit 3
 
Halftoning in Computer Graphics
Halftoning  in Computer GraphicsHalftoning  in Computer Graphics
Halftoning in Computer Graphics
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
 
Computer Graphics: Visible surface detection methods
Computer Graphics: Visible surface detection methodsComputer Graphics: Visible surface detection methods
Computer Graphics: Visible surface detection methods
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping Algorithm
 
Chapter 3 Output Primitives
Chapter 3 Output PrimitivesChapter 3 Output Primitives
Chapter 3 Output Primitives
 
Window to viewport transformation&amp;matrix representation of homogeneous co...
Window to viewport transformation&amp;matrix representation of homogeneous co...Window to viewport transformation&amp;matrix representation of homogeneous co...
Window to viewport transformation&amp;matrix representation of homogeneous co...
 
Bresenham's line algorithm
Bresenham's line algorithmBresenham's line algorithm
Bresenham's line algorithm
 
Composite transformation
Composite transformationComposite transformation
Composite transformation
 
Concept of basic illumination model
Concept of basic illumination modelConcept of basic illumination model
Concept of basic illumination model
 
Polygon mesh
Polygon  meshPolygon  mesh
Polygon mesh
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
 

Similar to Computer Graphic - Lines, Circles and Ellipse

Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithms
Mohammad Sadiq
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
Nanhen Verma
 
Lec05 circle ellipse
Lec05 circle ellipseLec05 circle ellipse
Lec05 circle ellipse
Maaz Rizwan
 
Unit 3
Unit 3Unit 3
2.circle
2.circle2.circle
2.circle
SakshiNailwal
 
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
 
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
 
Comuter graphics ellipse drawing algorithm
Comuter graphics ellipse drawing algorithmComuter graphics ellipse drawing algorithm
Comuter graphics ellipse drawing algorithm
Rachana Marathe
 
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
Wendy Pindah
 
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
 
Output Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and MultimediaOutput Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and Multimedia
saranyan75
 

Similar to Computer Graphic - Lines, Circles and Ellipse (20)

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
 
2.circle
2.circle2.circle
2.circle
 
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
 
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
 
Comuter graphics ellipse drawing algorithm
Comuter graphics ellipse drawing algorithmComuter graphics ellipse drawing algorithm
Comuter graphics ellipse drawing algorithm
 
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
 
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
 
Output Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and MultimediaOutput Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and Multimedia
 

More from 2013901097

Operation research - the revised simplex method
Operation research - the revised simplex methodOperation research - the revised simplex method
Operation research - the revised simplex method
2013901097
 
Computer Graphic - Clipping
Computer Graphic - ClippingComputer Graphic - Clipping
Computer Graphic - Clipping
2013901097
 
Computer Graphic - Projections
Computer Graphic - ProjectionsComputer Graphic - Projections
Computer Graphic - Projections
2013901097
 
Computer Graphic - Transformations in 3d
Computer Graphic - Transformations in 3dComputer Graphic - Transformations in 3d
Computer Graphic - Transformations in 3d
2013901097
 
Computer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2DComputer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2D
2013901097
 
the two phase method - operations research
the two phase method - operations researchthe two phase method - operations research
the two phase method - operations research
2013901097
 
The Big M Method - Operation Research
The Big M Method - Operation ResearchThe Big M Method - Operation Research
The Big M Method - Operation Research
2013901097
 
Operations research - Chapter 04
Operations research - Chapter 04Operations research - Chapter 04
Operations research - Chapter 04
2013901097
 
Operation research - Chapter 03
Operation research - Chapter 03Operation research - Chapter 03
Operation research - Chapter 03
2013901097
 
Operation research - Chapter 02
Operation research - Chapter 02Operation research - Chapter 02
Operation research - Chapter 02
2013901097
 
Operation research - Chapter 01
Operation research - Chapter 01Operation research - Chapter 01
Operation research - Chapter 01
2013901097
 

More from 2013901097 (11)

Operation research - the revised simplex method
Operation research - the revised simplex methodOperation research - the revised simplex method
Operation research - the revised simplex method
 
Computer Graphic - Clipping
Computer Graphic - ClippingComputer Graphic - Clipping
Computer Graphic - Clipping
 
Computer Graphic - Projections
Computer Graphic - ProjectionsComputer Graphic - Projections
Computer Graphic - Projections
 
Computer Graphic - Transformations in 3d
Computer Graphic - Transformations in 3dComputer Graphic - Transformations in 3d
Computer Graphic - Transformations in 3d
 
Computer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2DComputer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2D
 
the two phase method - operations research
the two phase method - operations researchthe two phase method - operations research
the two phase method - operations research
 
The Big M Method - Operation Research
The Big M Method - Operation ResearchThe Big M Method - Operation Research
The Big M Method - Operation Research
 
Operations research - Chapter 04
Operations research - Chapter 04Operations research - Chapter 04
Operations research - Chapter 04
 
Operation research - Chapter 03
Operation research - Chapter 03Operation research - Chapter 03
Operation research - Chapter 03
 
Operation research - Chapter 02
Operation research - Chapter 02Operation research - Chapter 02
Operation research - Chapter 02
 
Operation research - Chapter 01
Operation research - Chapter 01Operation research - Chapter 01
Operation research - Chapter 01
 

Recently uploaded

Premuim Call Girls Pune 🔥 7014168258 🔥 Real Fun With Sexual Girl Available 24...
Premuim Call Girls Pune 🔥 7014168258 🔥 Real Fun With Sexual Girl Available 24...Premuim Call Girls Pune 🔥 7014168258 🔥 Real Fun With Sexual Girl Available 24...
Premuim Call Girls Pune 🔥 7014168258 🔥 Real Fun With Sexual Girl Available 24...
$A19
 
Buy Best T-shirts for Men Online Buy Best T-shirts for Men Online
Buy Best T-shirts for Men Online Buy Best T-shirts for Men OnlineBuy Best T-shirts for Men Online Buy Best T-shirts for Men Online
Buy Best T-shirts for Men Online Buy Best T-shirts for Men Online
janvi$L14
 
GBSN - Biochemistry (Unit 12) Hormones
GBSN - Biochemistry (Unit 12) HormonesGBSN - Biochemistry (Unit 12) Hormones
GBSN - Biochemistry (Unit 12) Hormones
Areesha Ahmad
 
Cultivation of human viruses and its different techniques.
Cultivation of human viruses and its different techniques.Cultivation of human viruses and its different techniques.
Cultivation of human viruses and its different techniques.
MDAsifKilledar
 
Explainable Deepfake Image/Video Detection
Explainable Deepfake Image/Video DetectionExplainable Deepfake Image/Video Detection
Explainable Deepfake Image/Video Detection
VasileiosMezaris
 
The Limited Role of the Streaming Instability during Moon and Exomoon Formation
The Limited Role of the Streaming Instability during Moon and Exomoon FormationThe Limited Role of the Streaming Instability during Moon and Exomoon Formation
The Limited Role of the Streaming Instability during Moon and Exomoon Formation
Sérgio Sacani
 
My handmade SCIENCE PROJECT for students of class tenth.pptx
My handmade SCIENCE PROJECT for students of class tenth.pptxMy handmade SCIENCE PROJECT for students of class tenth.pptx
My handmade SCIENCE PROJECT for students of class tenth.pptx
YajatAgrahari
 
23PH301 - Optics - Unit 2 - Interference
23PH301 - Optics - Unit 2 - Interference23PH301 - Optics - Unit 2 - Interference
23PH301 - Optics - Unit 2 - Interference
RDhivya6
 
WHO 6TH EDITION UPDATE FOR SEMEN ANALYSIS
WHO 6TH EDITION UPDATE FOR SEMEN ANALYSISWHO 6TH EDITION UPDATE FOR SEMEN ANALYSIS
WHO 6TH EDITION UPDATE FOR SEMEN ANALYSIS
SRI AUROBINDO UNIVERSITY
 
Call Girls Versova ♨️ +91-9920725232 👈Open 24/7 at Top Mumbai Call Girls Service
Call Girls Versova ♨️ +91-9920725232 👈Open 24/7 at Top Mumbai Call Girls ServiceCall Girls Versova ♨️ +91-9920725232 👈Open 24/7 at Top Mumbai Call Girls Service
Call Girls Versova ♨️ +91-9920725232 👈Open 24/7 at Top Mumbai Call Girls Service
bhuhariaqueen9pm$S2
 
Embracing Deep Variability For Reproducibility and Replicability
Embracing Deep Variability For Reproducibility and ReplicabilityEmbracing Deep Variability For Reproducibility and Replicability
Embracing Deep Variability For Reproducibility and Replicability
University of Rennes, INSA Rennes, Inria/IRISA, CNRS
 
حبوب الاجهاض الامارات | 00971547952044 | حبوب اجهاض امارات للبيع
حبوب الاجهاض الامارات | 00971547952044 | حبوب اجهاض امارات للبيعحبوب الاجهاض الامارات | 00971547952044 | حبوب اجهاض امارات للبيع
حبوب الاجهاض الامارات | 00971547952044 | حبوب اجهاض امارات للبيع
حبوب الاجهاض الامارات حبوب سايتوتك الامارات
 
GBSN - Microbiology (Unit 2) Antimicrobial agents
GBSN - Microbiology (Unit 2) Antimicrobial agentsGBSN - Microbiology (Unit 2) Antimicrobial agents
GBSN - Microbiology (Unit 2) Antimicrobial agents
Areesha Ahmad
 
20240515_CEBaP Poster_SR eating_drinking.pdf
20240515_CEBaP Poster_SR eating_drinking.pdf20240515_CEBaP Poster_SR eating_drinking.pdf
20240515_CEBaP Poster_SR eating_drinking.pdf
Hans Van Remoortel
 
Call Girls Noida🔥9873777170🔥Gorgeous Escorts in Noida Available 24/7
Call Girls Noida🔥9873777170🔥Gorgeous Escorts in Noida Available 24/7Call Girls Noida🔥9873777170🔥Gorgeous Escorts in Noida Available 24/7
Call Girls Noida🔥9873777170🔥Gorgeous Escorts in Noida Available 24/7
yashika sharman06
 
Delhi Call Girls ✓WhatsApp 9999965857 🔝Top Class Call Girl Service Available
Delhi Call Girls ✓WhatsApp 9999965857 🔝Top Class Call Girl Service AvailableDelhi Call Girls ✓WhatsApp 9999965857 🔝Top Class Call Girl Service Available
Delhi Call Girls ✓WhatsApp 9999965857 🔝Top Class Call Girl Service Available
kk090568
 
Mites,Slug,Snail_Infesting agricultural crops.pdf
Mites,Slug,Snail_Infesting agricultural crops.pdfMites,Slug,Snail_Infesting agricultural crops.pdf
Mites,Slug,Snail_Infesting agricultural crops.pdf
PirithiRaju
 
Organic Farming and its importance today in the context of soil health and or...
Organic Farming and its importance today in the context of soil health and or...Organic Farming and its importance today in the context of soil health and or...
Organic Farming and its importance today in the context of soil health and or...
Nistarini College, Purulia (W.B) India
 
Casein in different samples of milk chemistry project
Casein in different samples of milk chemistry projectCasein in different samples of milk chemistry project
Casein in different samples of milk chemistry project
tyagivansh251
 
(Shilpa) ➤ Call Girls Lucknow 🔥 9352988975 🔥 Real Fun With Sexual Girl Availa...
(Shilpa) ➤ Call Girls Lucknow 🔥 9352988975 🔥 Real Fun With Sexual Girl Availa...(Shilpa) ➤ Call Girls Lucknow 🔥 9352988975 🔥 Real Fun With Sexual Girl Availa...
(Shilpa) ➤ Call Girls Lucknow 🔥 9352988975 🔥 Real Fun With Sexual Girl Availa...
shourabjaat424
 

Recently uploaded (20)

Premuim Call Girls Pune 🔥 7014168258 🔥 Real Fun With Sexual Girl Available 24...
Premuim Call Girls Pune 🔥 7014168258 🔥 Real Fun With Sexual Girl Available 24...Premuim Call Girls Pune 🔥 7014168258 🔥 Real Fun With Sexual Girl Available 24...
Premuim Call Girls Pune 🔥 7014168258 🔥 Real Fun With Sexual Girl Available 24...
 
Buy Best T-shirts for Men Online Buy Best T-shirts for Men Online
Buy Best T-shirts for Men Online Buy Best T-shirts for Men OnlineBuy Best T-shirts for Men Online Buy Best T-shirts for Men Online
Buy Best T-shirts for Men Online Buy Best T-shirts for Men Online
 
GBSN - Biochemistry (Unit 12) Hormones
GBSN - Biochemistry (Unit 12) HormonesGBSN - Biochemistry (Unit 12) Hormones
GBSN - Biochemistry (Unit 12) Hormones
 
Cultivation of human viruses and its different techniques.
Cultivation of human viruses and its different techniques.Cultivation of human viruses and its different techniques.
Cultivation of human viruses and its different techniques.
 
Explainable Deepfake Image/Video Detection
Explainable Deepfake Image/Video DetectionExplainable Deepfake Image/Video Detection
Explainable Deepfake Image/Video Detection
 
The Limited Role of the Streaming Instability during Moon and Exomoon Formation
The Limited Role of the Streaming Instability during Moon and Exomoon FormationThe Limited Role of the Streaming Instability during Moon and Exomoon Formation
The Limited Role of the Streaming Instability during Moon and Exomoon Formation
 
My handmade SCIENCE PROJECT for students of class tenth.pptx
My handmade SCIENCE PROJECT for students of class tenth.pptxMy handmade SCIENCE PROJECT for students of class tenth.pptx
My handmade SCIENCE PROJECT for students of class tenth.pptx
 
23PH301 - Optics - Unit 2 - Interference
23PH301 - Optics - Unit 2 - Interference23PH301 - Optics - Unit 2 - Interference
23PH301 - Optics - Unit 2 - Interference
 
WHO 6TH EDITION UPDATE FOR SEMEN ANALYSIS
WHO 6TH EDITION UPDATE FOR SEMEN ANALYSISWHO 6TH EDITION UPDATE FOR SEMEN ANALYSIS
WHO 6TH EDITION UPDATE FOR SEMEN ANALYSIS
 
Call Girls Versova ♨️ +91-9920725232 👈Open 24/7 at Top Mumbai Call Girls Service
Call Girls Versova ♨️ +91-9920725232 👈Open 24/7 at Top Mumbai Call Girls ServiceCall Girls Versova ♨️ +91-9920725232 👈Open 24/7 at Top Mumbai Call Girls Service
Call Girls Versova ♨️ +91-9920725232 👈Open 24/7 at Top Mumbai Call Girls Service
 
Embracing Deep Variability For Reproducibility and Replicability
Embracing Deep Variability For Reproducibility and ReplicabilityEmbracing Deep Variability For Reproducibility and Replicability
Embracing Deep Variability For Reproducibility and Replicability
 
حبوب الاجهاض الامارات | 00971547952044 | حبوب اجهاض امارات للبيع
حبوب الاجهاض الامارات | 00971547952044 | حبوب اجهاض امارات للبيعحبوب الاجهاض الامارات | 00971547952044 | حبوب اجهاض امارات للبيع
حبوب الاجهاض الامارات | 00971547952044 | حبوب اجهاض امارات للبيع
 
GBSN - Microbiology (Unit 2) Antimicrobial agents
GBSN - Microbiology (Unit 2) Antimicrobial agentsGBSN - Microbiology (Unit 2) Antimicrobial agents
GBSN - Microbiology (Unit 2) Antimicrobial agents
 
20240515_CEBaP Poster_SR eating_drinking.pdf
20240515_CEBaP Poster_SR eating_drinking.pdf20240515_CEBaP Poster_SR eating_drinking.pdf
20240515_CEBaP Poster_SR eating_drinking.pdf
 
Call Girls Noida🔥9873777170🔥Gorgeous Escorts in Noida Available 24/7
Call Girls Noida🔥9873777170🔥Gorgeous Escorts in Noida Available 24/7Call Girls Noida🔥9873777170🔥Gorgeous Escorts in Noida Available 24/7
Call Girls Noida🔥9873777170🔥Gorgeous Escorts in Noida Available 24/7
 
Delhi Call Girls ✓WhatsApp 9999965857 🔝Top Class Call Girl Service Available
Delhi Call Girls ✓WhatsApp 9999965857 🔝Top Class Call Girl Service AvailableDelhi Call Girls ✓WhatsApp 9999965857 🔝Top Class Call Girl Service Available
Delhi Call Girls ✓WhatsApp 9999965857 🔝Top Class Call Girl Service Available
 
Mites,Slug,Snail_Infesting agricultural crops.pdf
Mites,Slug,Snail_Infesting agricultural crops.pdfMites,Slug,Snail_Infesting agricultural crops.pdf
Mites,Slug,Snail_Infesting agricultural crops.pdf
 
Organic Farming and its importance today in the context of soil health and or...
Organic Farming and its importance today in the context of soil health and or...Organic Farming and its importance today in the context of soil health and or...
Organic Farming and its importance today in the context of soil health and or...
 
Casein in different samples of milk chemistry project
Casein in different samples of milk chemistry projectCasein in different samples of milk chemistry project
Casein in different samples of milk chemistry project
 
(Shilpa) ➤ Call Girls Lucknow 🔥 9352988975 🔥 Real Fun With Sexual Girl Availa...
(Shilpa) ➤ Call Girls Lucknow 🔥 9352988975 🔥 Real Fun With Sexual Girl Availa...(Shilpa) ➤ Call Girls Lucknow 🔥 9352988975 🔥 Real Fun With Sexual Girl Availa...
(Shilpa) ➤ Call Girls Lucknow 🔥 9352988975 🔥 Real Fun With Sexual Girl Availa...
 

Computer Graphic - 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
  翻译: