CG Final
CG Final
1
Date:
Output:
2
Teacher’s Signature
Date:
3
Date:
}
else
{
y = y + 1;
p = p + 2 * (dy - dx);
}
putpixel(x, y, 10);
}
getch();
}
Output:
4
Teacher’s Signature
Date:
5
Date:
d+=2*(big-r)+1;
}
putpixel((xc+big),(yc+r),5);
putpixel((xc+big),(yc-r),5);
putpixel((xc-big),(yc+r),5);
putpixel((xc-big),(yc-r),5);
putpixel((xc+r),(yc+big),5);
putpixel((xc+r),(yc-big),5);
putpixel((xc-r),(yc+big),5);
putpixel((xc-r),(yc-big),5);
}
getch();
}
Output:
6
Teacher’s Signature
Date:
7
Date:
p=p+b*b+fx-fy;
putpixel((xc+x),(yc+y),1);
putpixel((xc-x),(yc+y),1);
putpixel((xc+x),(yc-y),1);
putpixel((xc-x),(yc-y),1);
}
p=(b*b)*pow((x+0.5),2)+(a*a)*pow((y-1),2)-(a*a)*(b*b);
while(y>0)
{
y-=1;
fy=fy-2*a*a;
if(p<0)
{
x+=1;
fx=fx+2*b*b;
}
if(p>=0)
p=p+a*a-fy;
else
p=p+a*a-fy+fx;
putpixel((xc+x),(yc+y),1);
putpixel((xc-x),(yc+y),1);
putpixel((xc+x),(yc-y),1);
putpixel((xc-x),(yc-y),1);
}
getch();
closegraph();
}
Output:
8
Teacher’s Signature
Date:
9
Date:
Output:
10
Teacher’s Signature
Date:
11
Date:
Output:
12
Teacher’s Signature
Date:
13
Date:
Output:
14
Teacher’s Signature
Date:
15
Date:
Output:
16
Teacher’s Signature
Date:
17
Date:
Output:
18
Teacher’s Signature
Date:
Output:
19
Teacher’s Signature