Professional Documents
Culture Documents
Problem Statement:
Write C++/Java program to draw inscribed and Circumscribed circles in the triangle as shown as an
example below. (Use any Circle drawing and Line drawing algorithms)
Theory:
Line/ circle drawing is accomplished by calculating intermediate point co-ordinates along the
line path between two given end points.
1. Accept ( i/p) = (x1 , y1) and the length of side the equilateral triangle ie L
2. x2=x1+L, y2=y
3. x3=(x1+x)/3 y3=y1+h where h is the height of the triangle (h=sqrt(3/4)*L)
4. Draw the triangle with the vertices using DDA algorithm
5. Now calculate centre of the triangle/circles ie Xc=(x1+x)/2, Yc=y1+h/3
6. Radius of the inscribed circle Rin = h/3
7. Draw the Circle using Bresenham’s circle generation algorithm
8. Radius of the circumscribed circle Rcm = 2h/3
Class design
Private:
Int x1, y1,x2,y2,x3,y3;
Public:
Void Line_draw();
Void
Circle_draw(radius,
Xc,Yc);
Mathematical Model:
Equilateral triangle’s all 3 sides are equal & all interior angles are also equal.
(x1,y1) , (x2,y2),(x3,y3) as
Conclusion: Write atleast 2 points that you learnt during the practical. They may be solving the error
also.
Oral Questions: