C59 Exp2a
C59 Exp2a
A.2 Prerequisite:
1. C Language
A.3 Outcome:
After successful completion of this experiment students will
be able to
A.4 Theory:
Derivation of Mid Point Circle Algorithm
Derivation: Assume that a circle is passing through origin and it’s radius is
r . Then the equation of circle will be
x2+y2=r2
F(x,y)=x2+y2-r2
Po = 5/4 – r
If P is negative (P<=0)
Xk+1 – Xk = 1
Yk+1 – Yk = 0
Pk+1=Pk+Xk+1 + Xk +1+1
Pk+1 = Pk + 2Xk+1 + 1
If P is positive (P>0)
Xk+1 – Xk = 1
Yk+1 – Yk = 0
A.5 Procedure:
Mid-Point Circle ( Xc, Yc, R):
Description:
Here Xc and Yc denote the x – coordinate and y – coordinate of the center of the
circle. R is the radius.
1. Set X = 0 and Y = R
2. Set P = 1 – R
5. Set X = X + 1
6. If (P < 0) Then
7. P = P + 2X + 6
8. Else
9. Set Y = Y – 1
12. Exit
9. Exit
PARTB
Roll No. C-59 Name: Nikhil Girish Kindre
Class : C Batch : C3
Date of Experiment: 20 Aug 2024 Date of Submission
Grade :
B.1 Document created by the student:
B.3 Observations and learning:
B.4 Conclusion:
The Midpoint Circle Drawing Algorithm is efficient and accurate for plotting
circles by using integer arithmetic and geometric symmetry, reducing
computational overhead and avoiding floating-point operations.
1. Midpoint Circle Drawing Algorithm: Uses integer calculations and symmetry to plot
points around the circle.
2. Bresenham’s Circle Drawing Algorithm: An extension of Bresenham’s line algorithm
that uses incremental calculations for efficiency.
3. Parametric Circle Drawing: Uses the parametric equations of a circle to compute and
plot points, typically relying on floating-point arithmetic.
4. DDA (Digital Differential Analyzer) Circle Drawing: Uses differential equations to
compute the circle's points, generally less efficient than the midpoint or Bresenham’s
methods.
5. Polar Coordinates Circle Drawing: Computes circle points using polar coordinates and
then converts them to Cartesian coordinates for plotting.
Advantages:
1. Efficiency: Uses integer arithmetic and avoids floating-point calculations, leading to
faster performance.
2. Accuracy: Maintains precision by incrementally adjusting the error term.
3. Simplicity: Straightforward implementation that leverages symmetry to minimize
computations.
Disadvantages:
1. Limited Flexibility: Primarily designed for circle drawing; less adaptable for other
shapes.
2. Pixel Approximation: The algorithm approximates circles with pixels, which may not
perfectly represent circles at low resolutions.
3. Edge Cases: Can be less effective for circles with very large radii or at very high
resolutions.
The 8-way symmetry of a circle refers to the property that a circle is symmetric across
eight lines through its center, which divide it into eight equal parts. This includes:
5.
6. So it is only necessary to compute the pixels for 1/8 of the circle and then simply
illuminate the appropriate pixels in the other 7/8.
This symmetry allows algorithms to calculate only one-eighth of the circle's points and then
mirror them across these axes, simplifying calculations and reducing computation.