Computer Graphics (ITEC-613)
Lab Project 2: Drawing the Circle
By: Dr. Zeeshan Bhatti
Task 1: Draw the Circle using the simple Polynomial Method using CPP or JAVA
Basic Algorithm
For x= -R to R
y = sqrt(R2 - x2)
PlotPixel(x, round(y) );
PlotPixel(x, - round(y) );
end;
Solution in Matlab:
x = 0;
R = 10;
R1 = -R;
x = R1 : 1 : R ;
y= sqrt(R.^2 - x.^2);
plot (x, y, '.' , x, -y , 'x' ), xlabel('x-axis'), ylabel('y-axis'), title('Draw Line Graph '),
grid off , axis([-10 10 -10 10]);
Task 2: Write the code for creating a Circle using Bresenhams Algorithm for all 8 octants.
This is a Lab project, to be done and
submitted by each individual student during the Lab, every week.
Each student has to do the tasks given, print the Source Code, and
get it signed by the lecturer during each lab. Each Lab project has Marks
which will be given during the final exam, and the final
Viva Vice will also be conducted from these lab projects. Therefore,
Each student MUST complete these tasks individually and get it
signed during the lab session and finally Must bring
all the Lab Project files during the final Viva Vice for input of
Marks.
No comments:
Post a Comment