Lab Report 4: Title: Theory
Lab Report 4: Title: Theory
We denote F(p) with P. The value of P is calculated at the mid-point of the two contending
pixels i.e. (x-0.5, y+1). Each pixel is described with a subscript k.
The first point to be plotted is (r, 0) on the x-axis. The initial value of P is calculated as
follows:
P1 = (r – 0.5)2 + (0+1)2 – r2
= 1.25 – r
= 1 -r (When rounded off).
The code:
// Main Function
int main()
{
// Declaring the variables
float x1,y1,radius,p,x,y;
else if (p >= 0)
{
x++;
y--;
putpixel(x+x1,y+y1,2);
putpixel(y+x1,x+y1,2);
putpixel(-y+x1,x+y1,2);
putpixel(-x+x1,y+y1,2);
putpixel(-x+x1,-y+y1,2);
putpixel(-y+x1,-x+y1,2);
putpixel(y+x1,-x+y1,2);
putpixel(x+x1,-y+y1,2);
p+=(2*x-2*y+1);
}
}