Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
WWW.VIDYARTHIPLUS.COM
Ex:No.:2 IMPLEMENTATION OF BRESENHAM’S LINE DRAWING ALGORITHM
DATE:
AIM: To draw line using bresenham ALGORITHM in c.
ALGORITHM:
1. Input two line endpoints
2. Obtain starting value for the decision parameter as
P0=2∆y-∆x
3. If pk<0 the next point to plot is (xk+1,yk) and pk+1=pk+2∆y else next point
to plot is (xk+1,yk+1) and pk+1=pk+2∆y-2∆x
4. Repeat step 3 ∆x times.
CODING:
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
main()
{
int gd=DETECT,gm;
int xa,xb,ya,yb;
int dx,dy,X,Y,Xend,p,b;
initgraph(&gd,&gm,"c:\\tc\\bgi");
printf("ENTER TWO LEFT END POINTS");
scanf("%d%d",&xa,&ya);
printf("ENTER TWO RIGHT END POINTS ");
scanf("%d%d",&xb,&yb);
dx=abs(xa-xb);
dy=abs(ya-yb);
p=2*dy-dx;
if(xa>xb)
{
X=xb;
Y=yb;
Xend=xa;
}
else
{
X=xa;
Y=ya;
Xend=xb;
}
putpixel(X,Y,b);
WWW.VIDYARTHIPLUS.COM
while(X<Xend)
{
X=X+1;
if(p<0)
{
p=p+2*dy;
}
else
{
Y=Y+1;
p=p+2*(dy-dx);
}
putpixel(X,Y,b);
}
getch();
return(0);
}
OUTPUT:
Enter two left endpoints:
100
200
Enter two right endpoints:
300
400
RESULT:
WWW.VIDYARTHIPLUS.COM
Thus the C program to drawn the line using bresenham ALGORITHM was executed
successfully.
Ex:No.:1 IMPLEMENTATION OF DDA LINE DRAWING ALGORITHM
DATE:
AIM: To draw line using Digital Differential analyzer (DDA) ALGORITHM in c.
ALGORITHM:
1. Input two line endpoints
2. Obtain starting value for the decision parameter as
Po=2Δy-Δx
3. If pk<0 the next point to plot is(xk+1,yk) and pk+1=pk+2Δy else next point
to plot is (Xk+1,Yk+1) and Pk+1=Pk+2Δy-2Δx
4. Repeat step3 Δx times.
CODING:
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
void lineDDA(int,int,int,int);
void main()
{
int gd=DETECT,gm,xa,xb,ya,yb;
clrscr();
initgraph(&gd,&gm,"");
printf(" enter 4 points");
scanf("%d%d%d%d",&xa,&ya,&xb,&yb);
lineDDA(xa,ya,xb,yb);
getch();
}
void lineDDA(int xa,int ya,int xb,int yb)
{
int dx=xb-xa;
int dy=yb-ya;
int steps,b;
int k;
float xinc,yinc,x=xa,y=ya;
if (abs(dx)>abs(dy))
steps=abs(dx);
WWW.VIDYARTHIPLUS.COM
else
steps=abs(dy);
xinc=dx/(float)steps;
yinc=dy/(float)steps;
putpixel(abs(x),abs(y),b);
for(k=0;k<steps;k++)
{
x=x+xinc;
y=y+yinc;
putpixel(abs(x),abs(y),b);
}
}
OUTPUT:
Enter 4 points
100
200
300
400
WWW.VIDYARTHIPLUS.COM
RESULT:
Thus the C program to drawn the line using DDA ALGORITHM was executed
successfully.
Ex no : 3
DATE:
IMPLEMENTATION OF MIDPOINT CIRCLE ALGORITHM
AIM: To draw circle using midpoint circle ALGORITHM in c.
ALGORITHM:
1. Input radius r and circle center(xc,yc)
2. calculate the initial value of the decision parameter as
P0=5/4-r
3. If pk<0, the next point along the circle is calculated as pk+1=pk+2xk+1+1 otherwise
calculate using pk+1=pk+2xk+1+1-2yk+1
4. Repeat step 3 until x>=y.
CODING:
#include "stdio.h"
#include "conio.h"
#include "math.h"
#include "graphics.h"
main()
{
int gd=DETECT,gm;
int xcenter,ycenter,radius;
int p,x,y;
initgraph(&gd,&gm,"c:\\tc\\bgi");
x=0;
printf("Enter The Radius Value:\n");
scanf("%d",&radius);
y=radius;
printf("Enter The xcenter and ycenter Values:\n");
scanf("%d%d",&xcenter,&ycenter);
plotpoints(xcenter,ycenter,x,y);
p=1-radius;
while(x<y)
{
WWW.VIDYARTHIPLUS.COM
if(p<0)
x=x+1;
else
{
x=x+1;
y=y-1;
}
if(p<0)
p=p+2*x+1;
else
p=p+2*(x-y)+1;
plotpoints(xcenter,ycenter,x,y);
}
getch();
return(0);
}
int plotpoints(int xcenter,int ycenter,int x,int y)
{
putpixel(xcenter+x,ycenter+y,1);
putpixel(xcenter-x,ycenter+y,1);
putpixel(xcenter+x,ycenter-y,1);
putpixel(xcenter-x,ycenter-y,1);
putpixel(xcenter+y,ycenter+x,1);
putpixel(xcenter-y,ycenter+x,1);
putpixel(xcenter+y,ycenter-x,1);
}
OUTPUT:
Enter The Radius Value:
100
Enter The xcenter and ycenter Values:
100
200
WWW.VIDYARTHIPLUS.COM
RESULT:
Thus the C program to drawn the midpoint circle ALGORITHM was executed successfully.
Ex no : 4
Date : MIDPOINT ELLIPSE GENERATING ALGORITHM
AIM:
To draw ellipse using midpoint algorithm in C.
ALGORITHM:
1. Input rx,ry and ellipse center (xc,yc) and obtain first point on an ellipse centered at the origin as (x0,y0) = (0,ry).
2. Calculate the initial value of P in the region 1. 3. If P<0 the next point on ellipse is(xk+1,yk) and calculate P value, else
next point is(xk+1,yk-1) and calculate corresponding P value. 4. Calculate the initial value of P in region 2 and plot points based on its
value. 5. Determine symmetry points in other 3 quadrants. 6. Plot coordinate values x=x+xc and y=y+yc 7. Repeat steps for region 1 till 2((ry)^2)x >= 2((rx)^2)y.
CODING:
#include<stdio.h>
#include<conio.h>
WWW.VIDYARTHIPLUS.COM
#include<math.h>
#include<graphics.h>
main()
{
int gd=DETECT,gm,rx,ry,xc,yc,x,y,p;
initgraph(&gd,&gm,"");
printf("enter rx,ry,xc,yc values");
scanf("%f%f%f%f",&rx,&ry,&xc,&yc);
x=0;
y=ry;
p=(ry*ry)+(rx*rx/4)-(rx*rx*ry);
putpixel(x,y,1);
while((2*ry*ry*x)<(2*rx*rx*y))
{
if(p<0)
{ x=x+1;
}
else
{x=x+1;
y=y-1;
}
if(p<0)
{
WWW.VIDYARTHIPLUS.COM
p=p+(2*ry*ry*x)+(ry*ry);
}
else
{ p=p+(2*ry*ry*x)-(2*rx*rx*y)+(ry*ry);
}
putpixel(x,y,1);
}
p=((ry*ry)*(x+0.5)*(x+0.5))+((rx*rx)*(y-1)*(y-1))-(rx*rx*ry*ry);
while(y>=0)
{
if(p<0)
{ x=x+1;
y=y-1;
}
else
{ y=y-1;
}
if(p<0)
{
p=p-(2*rx*rx*y)+(rx*rx)+(2*ry*ry*x);
}
else
{
WWW.VIDYARTHIPLUS.COM
p=p-(2*rx*rx*y)+(rx*rx);
}
putpixel(x,y,1);
}
getch();
return(0);
}
OUTPUT:
Enter rx, ry ,xc ,yc values 10 20 100 200
WWW.VIDYARTHIPLUS.COM
RESULT:
The ellipse was drawn using midpoint algorithm successfully.
Ex:No.:5.a
DATE:
IMPLEMENTATION OF TWO DIMENSIONAL TRANSFORMATIONS
AIM: To apply 2D Geometric transformations for Translation ,Rotation, Scaling, Reflection
and Shear .
ALGORITHM:
1. Input upper left corner and lower right corner of the rectangle.
2. To translate the rectangle apply formula x1=x+tx and y1=y+ty
3. To rotate the rectangle apply
a1=(xa+((a-xa)*cos(theta)-(b-ya)*sin(theta)))
b1=(ya+((a-xa)*sin(theta)-(b-ya)*cos(theta)))
4. To scale the rectangle size
x1=x*sx;
y1=y*sy;
5. Reflection
a1=(xa+((a-xa)*cos(theta)-(-b-ya)*sin(theta)))
b1=(ya+((a-xa)*sin(theta)+(-b-ya)*cos(theta)))
6. Shearing
x1=x+(y*x1s)
y1=y
az1=az+(w*x1s)
w1=w
CODING:
#include<graphics.h>
WWW.VIDYARTHIPLUS.COM
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
int x1,x2,x3,y1,y2,y3,t,tx,sx,sy,shx,shy,ch;
float rx1,rx2,rx3,ry1,ry2,ry3;
float ang,theta;
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode,"C:\\TC\\BGI");
/* request for auto detection*/
errorcode = graphRESULT();
if(errorcode != grOk)
/* if error occours*/
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
else
{
do{
printf("\n1.Translation\n2.Reflection\n3.Rotation\n4.Scaling\n5.Shearing\n");
printf("\nEnter Your choice");
/* get the choice from the user*/
scanf("%d",&ch);
switch(ch)
{
case 1:
printf("\n Enter all coordinates values :");
/* get the coordinate values*/
scanf("%d %d %d %d %d %d",&x1,&y1,&x2,&y2,&x3,&y3);
printf("\n Before Translation ");
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
printf("\n Enter the value tranlsation factor :");
scanf("%d",&tx);
/* get the value for the translation factor*/
printf("\n After Translation\n ");
line(x1+tx,y1,x2+tx,y2);
/* draw the new translated image*/
line(x2+tx,y2,x3+tx,y3);
line(x3+tx,y3,x1+tx,y1);
break;
case 2:
WWW.VIDYARTHIPLUS.COM
printf("\n Enter all coordinates values :");
scanf("%d %d %d %d %d %d",&x1,&y1
,&x2,&y2,&x3,&y3);
printf("\n Before Reflection ");
/* draw the image before reflection*/
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
t=abs(y1-y3);
/* find the value of the reflection factor*/
printf("\n After Reflection ");
line(x1,y1+10+(2*t),x2,y2+10);
/* draw the reflected object*/
line(x2,y2+10,x3,y3+10);
line(x3,y3+10,x1,y1+10+(2*t));
break;
case 3:
printf("\n Enter all coordinates values :");
scanf("%d %d %d %d %d %d",&x1,&y1,&x2,&y2,&x3,&y3);
printf("\n Before Rotation ");
/* get the original coordinates*/
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
printf("\n Enter the rotation angle :");
/* get the angle for rotation*/
scanf("%f",&ang);
theta=((ang*3.14)/180);
/* convert the given angle*/
rx1=x1*cos(theta)-y1*sin(theta);
rx2=x2*cos(theta)-y2*sin(theta);
rx3=x3*cos(theta)-y3*sin(theta);
ry1=x1*sin(theta)+y1*cos(theta);
ry2=x2*sin(theta)+y2*cos(theta);
ry3=x3*sin(theta)+y3*cos(theta);
printf("\n After Rotation ");
/* draw the rotated image*/
line(rx1,ry1,rx2,ry2);
line(rx2,ry2,rx3,ry3);
line(rx3,ry3,rx1,ry1);
break;
case 4:
printf("\n Enter all coordinates values :");
scanf("%d %d %d %d %d %d",&x1,&y1,&x2,&y2,&x3,&y3);
WWW.VIDYARTHIPLUS.COM
printf("\n Before Scaling ");
/* get the scale factor*/
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
printf("\n Enter the Scale factor :");
scanf("%d %d",&sx,&sy);
printf("\n After Scaling ");
/* draw the object after scaling*/
line(x1+sx,y1+sy,x2+sx,y2+sy);
line(x2+sx,y2+sy,x3+sx,y3+sy);
line(x3+sx,y3+sy,x1+sx,y1+sy);
break;
case 5:
printf("\n Enter all coordinates values :");
scanf("%d %d %d %d %d %d",&x1,&y1,&x2,&y2,&x3,&y3);
printf("\n Before Shearing "
);
/* get the values for shearing*/
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
printf("\n Enter 0 for x-axis and 1 for y-axis: ");
scanf("%d",&ch);
if(ch==0)
{
printf("\n Enter the x-SHEAR (^.^) Value: ");
scanf("%d",&shx);
x1=x1+shx*y1;
x2=x2+shx*y2;
x3=x3+shx*y3;
}
else
{
printf("\n Enter the y-SHEAR (^.^) Value: ");
scanf("%d",­);
y1=y1+shy*x1;
y2=y2+shy*x2;
y3=y3+shy*x3;
}
printf("\n After Shearing ");
line(x1,y1,x2,y2);
/* draw the final object after shearing*/
line(x2,y2,x3,y3);
WWW.VIDYARTHIPLUS.COM
line(x3,y3,x1,y1);
break;
default:
exit(0);
break;
}
}
while(ch!=0);
}
getch();
closegraph();
/* close the graph*/
return 0;
}
OUTPUT:
1.Translation
2.Reflection
3.Rotation
4.Scaling
5.Shearing
Enter Your choice 1
Enter all coordinates values 213 236 253 321 256 214
Before Translation
WWW.VIDYARTHIPLUS.COM
Enter the value translation vector 32
After Translation
1. Translation
2.Reflection
3.Rotation
4.Scaling
5.Shearing
Enter Your choice 2
Enter all coordinates values 213 236 253 321 256 214
Before refection
After Reflection
WWW.VIDYARTHIPLUS.COM
1.Translation
2.Reflection
3.Rotation
4.Scaling
5.Shearing
Enter Your choice 3
Enter all coordinates values 213 236 253 321 256 214
Before Rotation
Enter the rotation angle 20
AfterRotation
1.Translation
2.Reflection
3.Rotation
WWW.VIDYARTHIPLUS.COM
4.Scaling
5.Shearing
Enter Your choice 4
Enter all coordinates values 213 236 253 321 256 214
Before Scaling
Enter the scale factor 10 5
After Scaling
1.Translation
2.Reflection
3.Rotation
4.Scaling
5.Shearing
Enter Your choice 4
Enter all coordinates values 213 236 253 321 256 214
Before Shearing
Enter 0 for x axis and 1 for y axis 0
Enter the x-shear value 1
WWW.VIDYARTHIPLUS.COM
After Shearing
Before Shearing
Enter 0 for x axis and 1 for y axis 1
Enter the y-shear value 1
RESULT:
Thus the C program to apply 2D transformation for Translation, Rotation ,Scaling
,Reflection and Shear was executed successfully.
Ex:No.: 5.b
DATE: IMPLEMENTATION OF COMPOSITE TWO DIMENSIONAL
TRANSFORMATIONS
AIM: To apply composite transformations to 2-Dimensional shapes in C.
ALGORITHM:
WWW.VIDYARTHIPLUS.COM
1.Input upper left corner and lower right corner of the rectangle.
2.To multiple translation the rectangle apply formula x1=x+tx and y1=y+ty
3.To rotate multiple times the rectangle apply
a1=(xa+((a-xa)*cos(theta)-(b-ya)*sin(theta)))
b1=(ya+((a-xa)*sin(theta)-(b-ya)*cos(theta)))
4.To composite scale the rectangle size
x1=x*sx;
y1=y*sy;
5.Composite Reflection
a1=(xa+((a-xa)*cos(theta)-(-b-ya)*sin(theta)))
b1=(ya+((a-xa)*sin(theta)+(-b-ya)*cos(theta)))
6. Composite Shearing
x1=x+(y*x1s);
y1=y;
az1=az+(w*x1s);
w1=w;
CODING:
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
int ch,x,y,az,i,w,ch1,ch2,xa,ya,ra,ra1,a[10],b[10],da,db;
float x1,y1,az1,w1,dx1,dy1,dx2,dy2,theta,theta1,x1s,y1s,sx2,sy2,sx1,sy1,a1[10],b1[10];
void main(){
int gd,gm;
clrscr();
detectgraph(&gd,&gm);
initgraph(&gd,&gm,"c:\\tc\\bgi");
printf("\nEnter the upper left corner of the rectangle:");
scanf("%d%d",&x,&y);
printf("\nEnter the lowest right corner of the rectangle:");
scanf("%d%d",&az,&w);
rectangle(x,y,az,w);
da=az-x;
db=w-y;
a[0]=x;
b[0]=y;
a[1]=x+da;
b[1]=y;
a[2]=x+da;
b[2]=y+db;
a[3]=x;
b[3]=y+db;
while(1){
printf("\n*****Composite 2D Transformations******");
printf("\n1.Translation\n2.Rotation\n3.Scaling\n4.Exit\n Enter your choice:");
WWW.VIDYARTHIPLUS.COM
scanf("%d",&ch);
switch(ch){
case 1:
detectgraph(&gd,&gm);
initgraph(&gd,&gm,"c:\\tc\\bgi");
rectangle(x,y,az,w);
printf("\n*****Translation******");
printf("\nEnter the value of 1st shift factor:");
scanf("%f%f",&dx1,&dy1);
printf("\nEnter the value of 2nd shift factor:");
scanf("%f%f",&dx2,&dy2);
x1=x+dx1;
y1=y+dy1;
az1=az+dx1;
w1=w+dy1;
rectangle(x1,y1,az1,w1);
x1=x1+dx2;
y1=y1+dy2;
az1=az1+dx2;
w1=w1+dy2;
rectangle(x1,y1,az1,w1);
break;
case 2:
detectgraph(&gd,&gm);
initgraph(&gd,&gm,"c:\\tc\\bgi");
rectangle(x,y,az,w);
printf("\n*****Rotation******");
printf("\nEnter the value of fixed point:");
scanf("%d%d",&xa,&ya);
printf("\nEnter the value of angle of rotation 1 & rotation 2:");
scanf("%d%d",&ra,&ra1);
theta=(float)(ra*(3.14/180));
for(i=0;i<4;i++){
a1[i]=(xa+((a[i]-xa)*cos(theta)-(b[i]-ya)*sin(theta)));
b1[i]=(ya+((a[i]-xa)*sin(theta)+(b[i]-ya)*cos(theta)));
}
for(i=0;i<4;i++){
if(i!=3)
line(a1[i],b1[i],a1[i+1],b1[i+1]);
else
line(a1[i],b1[i],a1[0],b1[0]);
}
theta1=theta+(float)(ra1*(3.14/180));
for(i=0;i<4;i++){
a1[i]=(xa+((a[i]-xa)*cos(theta1)-(b[i]-ya)*sin(theta1)));
b1[i]=(ya+((a[i]-xa)*sin(theta1)+(b[i]-ya)*cos(theta1)));
}
WWW.VIDYARTHIPLUS.COM
for(i=0;i<4;i++){
if(i!=3)
line(a1[i],b1[i],a1[i+1],b1[i+1]);
else
line(a1[i],b1[i],a1[0],b1[0]);
}
break;
case 3:
detectgraph(&gd,&gm);
initgraph(&gd,&gm,"c:\\tc\\bgi");
rectangle(x,y,az,w);
printf("\n*****Scaling******");
printf("\nEnter the value of Scaling factor1:");
scanf("%f%f",&sx1,&sy1);
printf("\nEnter the value of Scaling factor2:");
scanf("%f%f",&sx2,&sy2);
x1=x*sx1;
y1=y*sy1;
az1=az*sx1;
w1=w*sy1;
rectangle(x,y,az1,w1);
x1=x1*sx2;
y1=y1*sy2;
az1=az1*sx2;
w1=w1*sy2;
rectangle(x1,y1,az1,w1);
break;
case 4:
exit(0);
}
getch();
}
}
OUTPUT:
Enter the upper left corner of the rectangle:
100
100
Enter the lower right corner of the rectangle:
200
200
******2DTransformations*******
1.Translation
WWW.VIDYARTHIPLUS.COM
2.Rotation
3.Scaling
4.Exit
Enter your choice: 1
*******Translation*******
Enter the value of 1st shift factor: 50 50
Enter the value of 2nd shift factor: 100 100
******2DTransformations*******
1.Translation
2.Rotation
3.Scaling
4.Exit
Enter your choice: 2
*******Rotation*******
Enter the value of fixed point:
200
200
Enter the value of angle of rotation 1 & rotation 2: 50 70
******2DTransformations*******
WWW.VIDYARTHIPLUS.COM
1.Translation
2.Rotation
3.Scaling
4.Exit
Enter your choice: 3
********Scaling*******
Enter the value of Scaling factor1: 2 2
Enter the value of Scaling factor2: 2 2
RESULT:
Thus the C program for composite transformations to 2-Dimensional shapes was
executed successfully.
WWW.VIDYARTHIPLUS.COM
Ex:No.:6
DATE:
IMPLEMENTATION OF LINE CLIPPING
AIM: To clip the lines fallen outside the window using cohen Sutherland line clipping algorithm.
ALGORITHM:
1.Input two line endpoints
2.Calculate the differences between the endpoints and clipping boundaries
3.if line as to be clipped left side of the window p1(x)=x-xwmin and to clip right side set
p2(x)=xwmax-x
4. if line as to be clipped down side of the window p2(y)=y-ywmin and to clip upper side
set p2(y)=ywmax-y
CODING
#include<iostream.h>
#include<graphics.h>
#include<conio.h>
#include<stdlib.h>
typedef struct coord{
int x,y;
char code[4];
}pt;
class sulc{
public:
void drawwindow();
void drawline(pt p1,pt p2,int c1);
pt setcode(pt p);
int visibility(pt p1,pt p2);
pt resetendpt(pt p1,pt p2);
};
void sulc::drawwindow(){
setcolor(12);
line(150,100,450,100);
line(450,100,450,350);
line(450,350,150,350);
line(150,350,150,100);
}
void sulc::drawline(pt p1,pt p2,int c1){
setcolor(c1);
line(p1.x,p1.y,p2.x,p2.y);
}
pt sulc::setcode(pt p){
WWW.VIDYARTHIPLUS.COM
pt ptemp;
if(p.y<100)
ptemp.code[0]='1';
else
ptemp.code[0]='0';
if(p.y>350)
ptemp.code[1]='1';
else
ptemp.code[1]='0';
if(p.x>450)
ptemp.code[2]='1';
else
ptemp.code[2]='0';
if(p.x<150)
ptemp.code[3]='1';
else
ptemp.code[3]='0';
ptemp.x=p.x;
ptemp.y=p.y;
return(ptemp);
}
int sulc::visibility(pt p1,pt p2){
int i,flag=0;
for(i=0;i<4;i++){
if((p1.code[i]!='0')||(p2.code[i]!='0'))
flag=1;
}
if(flag==0)
return(0);
for(i=0;i<4;i++){
if((p1.code[i]==p2.code[i])&&(p1.code[i]=='1'))
flag=0;
}
if(flag==0)
return(1);
return(2);
}
pt sulc::resetendpt(pt p1,pt p2){
pt temp;
int x,y,i;
float m,k;
if(p1.code[3]=='1')
x=150;
if(p1.code[2]=='1')
x=450;
if((p1.code[3]=='1')||(p1.code[2]=='1')){
m=(float)(p2.y-p1.y)/(p2.x-p1.x);
WWW.VIDYARTHIPLUS.COM
k=(p1.y+(m*(x-p1.x)));
temp.y=k;
temp.x=x;
for(i=0;i<4;i++)
temp.code[i]=p1.code[i];
if(temp.x<=450&&temp.x>=150)
return(temp);
}
if(p1.code[0]=='1')
y=100;
if(p1.code[1]=='1')
y=350;
if((p1.code[0]=='1')||(p1.code[1]=='1')){
m=(float)(p2.y-p1.y)/(p2.x-p1.x);
k=(float)p1.x+(float)(y-p1.y)/m;
temp.x=k;
temp.y=y;
for(i=0;i<4;i++)
temp.code[i]=p1.code[i];
if(temp.y<=350&&temp.y>100)
return(temp);
}
else
return(p1);
}
void main(){
int gd=DETECT,gm,v;
sulc c1;
pt p1,p2,ptemp;
initgraph(&gd,&gm,"c:\\tc\\bgi");
int x1[10],y1[10],x2[10],y2[10];
cleardevice();
int i,n;
settextstyle(4,0,4);
outtext("\n*****Cohen Sutherland Line Clipping*****");
cout<<"\n\n\nEnter the no. of lines:";
cin>>n;
for(i=0;i<n;i++){
cout<<"\nEnter end point1(x1,y1):";
cin>>x1[i]>>y1[i];
cout<<"\nEnter end point2(x2,y2):";
cin>>x2[i]>>y2[i];
}
cleardevice();
settextstyle(0,0,3);
outtext("\nBefore Clipping");
c1.drawwindow();
WWW.VIDYARTHIPLUS.COM
for(i=0;i<n;i++){
p1.x=x1[i];
p1.y=y1[i];
p2.x=x2[i];
p2.y=y2[i];
c1.drawline(p1,p2,15);
}
getch();
cleardevice();
settextstyle(0,0,3);
outtext("\nAfter Clipping");
for(i=0;i<n;i++){
p1.x=x1[i];
p1.y=y1[i];
p2.x=x2[i];
p2.y=y2[i];
p1=c1.setcode(p1);
p2=c1.setcode(p2);
v=c1.visibility(p1,p2);
switch(v){
case 0:
c1.drawwindow();
c1.drawline(p1,p2,15);
break;
case 1:
c1.drawwindow();
break;
case 2:
p1=c1.resetendpt(p1,p2);
p2=c1.resetendpt(p2,p1);
c1.drawwindow();
c1.drawline(p1,p2,15);
break;
}
}
getch();
closegraph();
}
WWW.VIDYARTHIPLUS.COM
OUTPUT:
Enter the no.of lines: 1
Enter end-point1(x1,y1):30 40
Enter end-point1(x2,y2):300 400
Before clipping
After clipping
WWW.VIDYARTHIPLUS.COM
RESULT:
Thus the line clipping ALGORITHM was executed successfully.
Ex:No.:7
DATE:
IMPLEMENTATION OF 3D TRANSFORMATION
AIM: To apply transformation such as Translation, Rotation, Scaling to 3-Dimensional shapes
in c++..
ALGORITHM:
1. To translate the cube apply formula
x3=x1+tx
y3=y1+ty
z3=z1+tz
2. To rotate the cube apply
x3=x1;
y3=y1*cos(theta)-z1*sin(theta)
z3=y1*sin(theta)+z1*cos(theta)
3. To scale the cube size
x3=xf+(x1*sx)+xf*(1-sx)
y3=yf+(y1*sy)+yf*(1-sy)
z3=zf+(z1*sz)+zf*(1-sz)
CODING:
#include<iostream.h>
#include<graphics.h>
#include<math.h>
#include<conio.h>
#include<stdlib.h>
class cube{
public:
void drawcube(int x1[],int y1[]){
int i;
for(i=0;i<4;i++){
if(i<3)
line(x1[i],y1[i],x1[i+1],y1[i+1]);
WWW.VIDYARTHIPLUS.COM
line(x1[0],y1[0],x1[3],y1[3]);
}
for(i=4;i<8;i++){
if(i<7)
line(x1[i],y1[i],x1[i+1],y1[i+1]);
line(x1[4],y1[4],x1[7],y1[7]);
}
for(i=0;i<4;i++){
line(x1[i],y1[i],x1[i+4],y1[i+4]);
}
}
};
void main(){
int
i,x1[8],y1[8],x2[8],y2[8],z1[8],x3[8],y3[8],z3[8],x4[8],y4[8],theta,op,ch,tx,ty,tz,sx,sy,sz,xf,yf,zf,
x,y,z,size;
int driver=DETECT;
int mode;
initgraph(&driver,&mode,"c:\\tc\\bgi");
cout<<"enter the points on the cube:";
cin>>x>>y>>z;
cout<<"enter the size of the edge:";
cin>>size;
x1[0]=x1[3]=x;
x1[1]=x1[2]=x+size;
x1[4]=x1[7]=x;
x1[5]=x1[6]=x+size;
y1[0]=y1[1]=y;
y1[2]=y1[3]=y+size;
y1[4]=y1[5]=y;
y1[6]=y1[7]=y+size;
z1[1]=z1[2]=z1[3]=z1[0]=z;
z1[4]=z1[5]=z1[6]=z1[7]=z-size;
for(i=0;i<8;i++){
x2[i]=x1[i]+z1[i]/2;
y2[i]=y1[i]+z1[i]/2;
}
cube c;
getch();
cleardevice();
do{
cout<<"menu"<<endl;
cout<<"\n 1.Translation\n 2.Rotation\n 3.Scaling\n 4.Exit\n";
cout<<"enter the choice:";
cin>>ch;
switch(ch){
case 1:
WWW.VIDYARTHIPLUS.COM
cout<<"enter the translation vector:";
cin>>tx>>ty>>tz;
for(i=0;i<8;i++){
x3[i]=x1[i]+tx;
y3[i]=y1[i]+ty;
z3[i]=z1[i]+tz;
}
for(i=0;i<8;i++){
x4[i]=x3[i]+z3[i]/2;
y4[i]=y3[i]+z3[i]/2;
}
cleardevice();
cout<<"before translation";
c.drawcube(x2,y2);
getch();
cleardevice();
cout<<"after translation";
c.drawcube(x4,y4);
getch();
cleardevice();
break;
case 2:
cout<<"enter the rotation angle:";
cin>>theta;
theta=(theta*3.14)/180;
cout<<"enter the direction"<<endl;
cout<<"1.Rotation about x axis"<<endl<<"2.Rotation about y axis"<<endl<<"3.Rotation about z
axis";
cin>>op;
if(op==1){
for(i=0;i<8;i++){
x3[i]=x1[i];
y3[i]=y1[i]*cos(theta)-z1[i]*sin(theta);
z3[i]=y1[i]*sin(theta)+z1[i]*cos(theta);
}
}
else
if(op==2){
for(i=0;i<8;i++){
y3[i]=y1[i];
x3[i]=z1[i]*cos(theta)-x1[i]*sin(theta);
x3[i]=z1[i]*sin(theta)+x1[i]*cos(theta);
}
}
else
if(op==3){
for(i=0;i<8;i++){
WWW.VIDYARTHIPLUS.COM
z3[i]=z1[i];
x3[i]=x1[i]*cos(theta)-y1[i]*sin(theta);
y3[i]=x1[i]*sin(theta)+y1[i]*cos(theta);
}
}
else
cout<<"enter correct option";
for(i=0;i<8;i++){
x4[i]=x3[i]+z3[i]/2;
y4[i]=y3[i]+z3[i]/2;
}
cleardevice();
cout<<"before rotation";
c.drawcube(x2,y2);
getch();
cleardevice();
cout<<"after rotation";
c.drawcube(x4,y4);
getch();
cleardevice();
break;
case 3:
cout<<"enter scaling factor:";
cin>>sx>>sy>>sz;
cout<<"enter the reference point:";
cin>>xf>>yf>>zf;
for(i=0;i<8;i++){
x3[i]=xf+(x1[i]*sx)+xf*(1-sx);
y3[i]=yf+(y1[i]*sy)+yf*(1-sy);
z3[i]=zf+(z1[i]*sz)+zf*(1-sz);
}
for(i=0;i<8;i++){
x4[i]=x3[i]+z3[i]/2;
y4[i]=y3[i]+z3[i]/2;
}
cleardevice();
cout<<"before scaling";
c.drawcube(x2,y2);
getch();
cleardevice();
cout<<"after scaling";
c.drawcube(x4,y4);
getch();
break;
case 4:
exit(0);
break;
WWW.VIDYARTHIPLUS.COM
}
}
while(op!=4);
getch();
}
OUTPUT:
Enter the point in the cube: 100 100 100
Enter the size of the edge: 50
Menu
1. translation
2. rotation
3. scaling
4. exit
Enter the choice:1
Enter the translation vector: 5,10,15
Before translation After translation
WWW.VIDYARTHIPLUS.COM
RESULT: Thus the C++ program for transformation such as Translation, Rotation, Scaling to 3-
Dimensional shapes was executed successfully.
Ex:No.:8
DATE:
IMPLEMENTATION OF 3D PROECTIONS
AIM: To write a ‘c’ program to perform projection( Parallel, Perspective) of 3D image
ALGORITHM
1. start the program.
2. Declare the variables using structure.
3. Create the function and get the function using create() function.
4. Get the coordinates and assign the values for the coordinates.
5. Define the drawcube() function.
6. Using rotate() function,rotation is performed.
7. End the program.
CODING
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void fun(int xm,int ym,int xma,in
t yma,int x1,int y1,int x2,int y2)
{
rectangle(xm,ym,xma,yma);
rectangle(x1,y1,x2,y2);
line(xm,ym,x1,y1);
line(xm,yma,x1,x2); line(xma,yma,x1,y2);
line(xma,ym,x2,y1); getch();
WWW.VIDYARTHIPLUS.COM
}
void main()
{
int x1,y1,x2,y2,xm,ym,xma,yma,dep,ch,d;
int gd=DETECT,gm;
initgraph(&gd,&gm," ");
printf("\n enter the TOP-LEFT
and BOTTOM-RIGHT CORNER:");
scanf("%d%d%d%d",&xm,&ym,&xma,&yma);
printf("\n Enter the
depth along z axis:");
scanf("%d",&dep);
cleardevice();
d=dep/2;x1=xm+d;y1=ym-d;x2=xma+d;y2=yma-d;
fun(xm,ym,xma,yma,x1,y1,x2,y2);
do
{
cleardevice();
outtextxy(20,20,"MENU"); outtextxy(20,30,"..........");
outtextxy(20,40,"1.PARA
LLEL PROJECTION");
outtextxy(20,50,"2.PRESPECTIVE PROJECTION");
outtextxy(20,60,"3.EXIT"); outtext
xy(20,70,"ENTER THE OPTION");
scanf("%d",&ch);
switch(ch)
{
case 1:
rectangle(xma+100,ym+100,xma+100+dep,yma);
outtextxy(xma+150,(ym+10+yma)/2,"SLIDE SHOW");
rectangle(xm,ym+150,xma,yma+150);
outtextxy(xm+20,(ym+yma)/2+250,"FRONT VIEW");
outtextxy(xm+20,(ym+yma)/2+20,"TO VIEW");
rectangle(xm,ym,xma,xm+dep);
getch();
break;
case 2:
fun(xm/2,ym/2,xma
/2,yma/2,x1/2,y1/2,x2/2,y2/2);
break;
}
cleardevice();
}
while(ch==1||ch==2);closegraph();
}
WWW.VIDYARTHIPLUS.COM
OUTPUT:
ENTER THE TOP-LEFT AND BOTTOM RIGHT CORNER:
50 50 100 100
ENTER THE DEPTH ALONG Z AXIS: 20
MENU:
1. PARALLEL PROJECTION
2. PRESPECTIVE PROJECTION
3. EXIT
ENTER UR OPTION: 1
ENTER UR OPTION: 2
PRESPECTIVE PROJECTION
WWW.VIDYARTHIPLUS.COM
RESULT:
Thus the c Program for 3D Projection was executed successfully.
EXNO:9
DATE: IMPLEMENTATION OF WINDOW-VIEWPORT MAPPING
AIM:
To implement window to viewport mapping using c program
ALGORITHM:
1.Enter the window and view-port co-ordinates.
2.Enter image vertices.
WWW.VIDYARTHIPLUS.COM
3.Using this window port is displayed” x[i]=xvmin+((x[i]-xwmin)*sx);
Y[i]=yvmin+((y[i]-ywmin)*sy);
4.Using this viewport mapping is done “line(x[i],y[i],x[i+1],y[i+1]);”
PROGRAM:
#include"stdio.h"
#include"conio.h"
#include"graphics.h"
#include"stdlib.h"
void main()
{
float xwmin,xwmax,ywmax,ywmin;
float xvmin,xvmax,yvmax,yvmin;
float x[10],y[10],yv,xv,sx,sy;
int gd=DETECT,gm,i;
clrscr();
printf("\n enter window port coordinates:\n(xwmin,ywmin,xwmax,ywmax): ");
scanf("%f%f%f%f",&xwmin,&ywmin,&xwmax,&ywmax);
printf("\n enter view port coordinates:\n(xvmin,yvmin,xvmax,yvmax): ");
scanf("%f%f%f%f",&xvmin,&yvmin,&xvmax,&yvmax);
printf("\n enter vertices for triangle: ");
WWW.VIDYARTHIPLUS.COM
for(i=0;i < 3;i++)
{
printf("\n enter(x%d,y%d):",i,i);
scanf("%f%f",&x[i],&y[i]);
}
sx=((xvmax-xvmin)/(xwmax-xwmin));
sy=((yvmax-yvmin)/(ywmax-xwmin));
initgraph(&gd,&gm," ");
outtextxy(80,30,"window port");
rectangle(xwmin,ywmin,xwmax,ywmax);
for(i=0;i <2;i++)
{
line(x[i],y[i],x[i+1],y[i+1]);
}
line(x[2],y[2],x[0],y[0]);
getch();
cleardevice();
for(i=0;i <3;i++)
{
x[i]=xvmin+((x[i]-xwmin)*sx);
y[i]=yvmin+((y[i]-ywmin)*sy);
}
outtextxy(150,10,"view port");
rectangle(xvmin,yvmin,xvmax,yvmax);
WWW.VIDYARTHIPLUS.COM
for(i=0;i <2;i++)
{
line(x[i],y[i],x[i+1],y[i+1]);
}
line(x[2],y[2],x[0],y[0]);
getch();
}
OUTPUT:
WWW.VIDYARTHIPLUS.COM
RESULT:
Thus window to viewport mapping is done successfully.
WWW.VIDYARTHIPLUS.COM
Ex:No.:10
DATE:
3- DIMENSIONAL OBJECTS AND SCENES
AIM:
To create 3D objects and scenes using blender animation software.
ALGORITHM:
1. Place the cursor to center by pressing shift+S and selecting cursor to center option from
the menu.
2. Add an object by pressing shift+A and selecting the cube object from the pop menu.
3. Shape of the object can be modified to a human body by dividing the object and
expanding part of the divided object.
4. Animating the human body done by placing the armature bones in arms and legs of the
human body.
5. Bones has to be deformed with the human body such that arms and legs of the human
body moves when the bone moves.
6. Using key frames, movements of the human body can be given for each timeline.
Procedure:
Blender provides you with twenty Layers to help organize your work. You can see which
Layers are currently visible from the group of twenty buttons in the 3D View window header.
Building the Body:
Change to the front view with 1 Numpad. pressing Space » Add » Mesh » Cube. A cube
will appear. Press tab, and it will be in Edit mode with all its vertices selected. Edit mode is a
mode in which you can edit the vertices of the mesh.
By default, all vertices are selected for every new object created. Object mode is a mode
where vertices cannot be selected or individually edited. The object can be changed only as a
whole. Press tab to switch between these two modes. This will split each side of the cube in two,
creating new vertices and faces.
With your cursor hovering in the 3D window press A to deselect all elements Now locate
the Subdivide button in the Mesh Tools panel and press it once. Go to right view by pressing 3
Numpad. And select the top two faces of the subdivided cube by right clicking the faces with the
face selection button on. From modifiers panel select add modifiers and select mirror option.
Now extrude the top right two faces by selecting extrude region or pressing e.
Extrude by moving the mouse till the needed size for the hands. Here, the both side top
right and left two faces extrudes as the mirror option is selected. Similarly, change to bottom
view and select the left two faces in face selection mode and change to front view.
Rotate the faces slight to the left direction by pressing R and moving mouse to the left.
After the needed rotate press left mouse button. Now select extrude region and extrude the leg
part where the both sides are extruded as the mirror is selected. Change to Object mode by press
tab and click on the Apply button of the Mirror modifier.
Make sure you are in Edit mode. Move the cursor to exactly one Blender Unit (grid
square) above Gus’s body (leftmost image in Giving Gus a head). To place the cursor at a
specific grid point, position it near to where you want it, then press shift+s to summon the Snap
WWW.VIDYARTHIPLUS.COM
menu. The Cursor ➔ Grid entry places the cursor exactly on a grid point. Cursor ➔ Selection
places it exactly on the selected object.
Add a new cube with shift+s » Add » Cube. So far, what we have is a rough figure, at
best. To make Gus appear smoother, locate the Modifiers panel in the Editing context, and add a
Subsurface modifier. To apply our smoothing effect to Gus, press the Set Smooth button found
in the Link and Materials panel of the Editing context. Gus should now appear smooth.
Animating Gus:
Rigging
• In object mode, set your 3D cursor where Gus’s shoulder is, and press shift+s » Add »
Armature. A rhomboidal object will appear, which is a bone of the armature system. Enter Edit
mode. The end, or tip, of the bone is selected (yellow).
• Now in Edit mode, place the tip of the bone in Gus’s hand by grabbing G and moving it,
(Adding the first bone, an elbowless arm). We don’t need any other bones right now. You should
now have one bone running from the shoulder to the hand area. As you move the tip, you will
notice that the whole bone gets bigger – you really are scaling up the bone.
• Periodically look at the Gingerbread man and armature from many different viewpoints
to make sure the armature is inside the gingerbread man, just as bones are inside a human body.
• Stay in Edit mode, then move the cursor to where the hip joint will be and add a new
bone shift+s » Add » Bone.
• Grab G and move the yellow tip of the new bone to the knee area.
• Now “chain” a new bone from the knee to the foot clicking in the area of the foot. A new
chained bone will appear automatically linked with the knee and ending at the foot. Another way
of chaining the new bone would be to extrude using the E shortcut. This variation creates the
new bone and places you in grab mode automatically. Similarly place the bones on the right side.
Posing
• Select the armature only, then select Pose Mode from the Mode menu (Mode menu in the
3D window header) – or simply hit Ctrl⇆ Tab. This option is only available when an armature is
selected.
• The armature will turn blue. You are now in Pose mode. If you now select a bone it will
turn cyan, not pink, and if you move it (G), or rotate it (R), the body will deform accordingly!
Original position
• Blender remembers the original position of the bones. You can set your armature back by
pressing AltR to clear the bones’ rotation, and AltG to clear their location. Alternatively, the Rest
Position button may be used to temporarily show the original position.
Inverse Kinematics
• Inverse Kinematics (IK) is where you actually define the position of the last bone in the
chain, often called an “end effector”. All the other bones assume an ALGORITHMic position,
automatically computed by the IK solver, to keep the chain without gaps (i.e. IK will
mathematically solve the chain positions for us). This allows a much easier and precise
positioning of hands and feet using IK.
Forward Kinematics
WWW.VIDYARTHIPLUS.COM
• While handling bones in Pose mode, notice that they act as rigid, inextensible bodies with
spherical joints at the end. You can grab only the first bone of a chain and all the others will
follow it. All subsequent bones in the chain cannot be grabbed and moved, you can only rotate
them, so that the selected bone rotates with respect to the previous bone in the chain while all the
subsequent bones of the chain follow its rotation.
• This procedure, called Forward Kinematics (FK), is easy to follow but it makes precise
location of the last bone in the chain difficult.
• Make Gus walk, using FK, by defining four different poses relative to four different
stages of a stride. Blender will do the work of creating a fluid animation.
• First, verify that you are at frame 1 of the timeline. The frame number appears in a
numeric field on the right of the Buttons window header (The current frame numeric field in the
Buttons window header). If it is not set to 1, set it to 1 now.
• Now, by rotating only one bone at a time (R), we’ll raiseUpLeg.L and bend LoLeg.L
backwards while raising Arm.Ra little and lowering Arm.L a little, as shown in (Our first pose).
• Select all bones with A. With the mouse pointer on the 3D window, press I. A menu pops
up (Storing the pose to the frame). Select LocRot from this menu. This will get the position and
orientation of all bones and store them as a pose at frame 1. This pose represents Gus in the
middle of his stride, while moving his left leg forward and above the ground.
• Now move to frame 11 either by entering the number in the numeric field or by pressing
↑. Then move Gus to a different position, like (Our second pose). Start with clearing the rotation
on both arms using AltR as mentioned earlier. From the top view, rotate Arm.R slightly forward
and Arm.L slightly back. Finish the pose with his left leg forward and right leg backward, both
slightly bent. Gus is walking in place!
• Select all bones again and press I to store this pose at frame11, and select Rot.
• We now need a third pose at frame 21, with the right leg up, because we are in the middle
of the other half of the stride. This pose is the mirror of the one we defined at frame 1. Therefore,
return to frame 1 and, with all the bones selected, in the Pose menu of the 3D window header,
select theCopy Current Pose entry, see (Pose menu). You have now copied the current pose to
the buffer.
• Go to frame 21 and paste the pose with thePaste Flipped Pose option in the Pose menu,
see (Pose menu). This will paste the cut pose, exchanging the positions of bones with suffix “.L”
with those of bones with suffix “.R”, effectively flipping it!
The pose is there but it has not been stored yet! You must press I » Rot with all bones selected.
• Now apply the same procedure to copy the pose at frame 11to frame 31, also flipping it.
• To complete the cycle, we need to copy the pose at frame 1,without flipping it, to frame
41. Do so by copying it as usual, and by using the Paste Pose entry. End the sequence by storing
the pose with I » Rot.
WWW.VIDYARTHIPLUS.COM
OUTPUT:
WWW.VIDYARTHIPLUS.COM
WWW.VIDYARTHIPLUS.COM
RESULT:
Thus the 3D object and scenes was created and animated using the blender software.
Ex:No.:11
DATE:
IMAGE EDITING AND MANIPULATION
AIM:
To perform basic operations on image using any image editing software, creating gif
animated images, Image optimization
a) Basic operations on image using any Image Editing Software (photopad software)
http://www.nchsoftware.com/
PhotoPad picture editing software is an easy digital photo editor.
Easily edit digital photos and other pictures
Supports all popular image formats
Crop, rotate, resize and flip photos fast
PhotoPad is designed to be ready to open and edit your photos quickly.
WWW.VIDYARTHIPLUS.COM
Photo Editing Features
Crop, rotate, resize and flip pictures
Touch up photos to remove red-eye and blemishes
Apply photo effects, including oil paint, cartoon, vignette, sepia and many more
Improve photo quality and focus with blur, sharpening and noise reduction tools
Adjust image color/hue, saturation, brightness and contrast
Create collages and photo mosaics with your photographs
Photo stitching to make your own panorama images
Load jpg, gif, png and other popular image formats
Add text and captions to photos
Insert clipart from the included clipart library
Add frames and borders around your photographs
Change the aspect ratio of an image without distorting key features using the liquid resize
effect
Non-destructive editing allows easy modifications of individual photo effects on the
layers list
Upload edited pictures directly to Facebook or Flickr
Edit photos and images
PhotoPad features include crop, rotate and resize, as well as effects like sepia tones, red eye reduction,
hue adjustment, saturation and brightness, plus more. PhotoPad is easy and intuitive to use, so you can
quickly open and edit your photos with great RESULTs.
PhotoPad's revamped interface makes adding effects and filters easy.
WWW.VIDYARTHIPLUS.COM
Quickly fine-tune effects and settings.
WWW.VIDYARTHIPLUS.COM
(b) Creating gif animated images using GIF animator
http://www.gif-animator.com/features.html
GIF Animator is a powerful yet easy to use animated GIF editor. It allows you to easily create
animated banners, buttons, userpics, GIF images for your website, presentation, e-mail, etc. GIF
Animator includes a wizard tool to make creating high quality animation fast and
straightforward.
WWW.VIDYARTHIPLUS.COM
Experts named it number one animated GIF maker when considering performance, number of
options and ease of use. GIF Animator can be used both by amateur designers and professionals.
No special training or knowledge is required!
Key Features
Internet is a very competitive medium indeed. Every year millions of new domains enter the Net,
making it even more difficult to attract new visitors. Nowadays, one needs to use bright, vivid,
flashy, dynamic images to make your website successful.
We believe that, beside the low price, the strongest point of our software is that you get very
powerful set of professional tools, yet you don't have to have any special training to use this
application. While you can use GIF Animator in conjunction with Windows Paint, PaintShop Pro
or Adobe Photoshop, it is a stand alone application with all necessary features:
Features list
Easy-to-use Intuitive Interface
The interface is so simple and intuitive that one hardly needs the User Manual to use the program
Animation Wizard
Creating GIF animation is fast and easy with Animation Wizard. Many special effects and
customizable options are included for enhancing and perfecting your GIF animation.
Built-In Image Editor
Edit animation frames directly from the GIF Animator. Built-in Image Editor includes full set of
editing tools. You can undo all the changes if something does not turn out how you expect it.
Multiple graphics formats
You can use a large number of different graphics formats in GIF Animator, including JPEG,
PNG, TIFF, GIF, BMP, PSD, ICO, PCX, PIC, RLE, DIB, PCD, AVI, WMF and many others.
Wizard tool with a bunch of special effects and transitions
Create animated GIF from scratch or edit existing GIF file
Compatible with Windows 9x/Me/NT/2000/XP/Vista/7/8
Convert AVI video files to the studio quality GIF animation
20+ graphics formats support (JPG, PNG, PSD, TIFF, etc)
Built-in Image Editor with full set of editing tools
WWW.VIDYARTHIPLUS.COM
Complete support of all GIF file format variations
Advanced optimization for the smallest possible file sizes
Considerably decrease web page download times, reduce server load, bandwidth charges and
save disk space
Batch Mode
Create animated gif images from command line in batch mode
International Interface
Advanced GIF Animator is able to speak your native language
Advanced Open Picture Dialog (Thumbnailer)
Automated generation of HTML code
HTML source is generated for easy insertion into Web page
Screen shots:
WWW.VIDYARTHIPLUS.COM
(c) Image optimization tool(http://www.imageoptimizer.net/)
Resize, compress and optimize your image files.
Image optimizer
WWW.VIDYARTHIPLUS.COM
OUTPUT:
RESULT:
WWW.VIDYARTHIPLUS.COM
Thus the basic operations on image using image editing software (PhotoPad Photo
Editing Software), creating gif animated images (GIF animator) and Image
optimization(Image optimizer )completed successfully
Ex:No.:12
DATE:
2D ANIMATION
( To create Interactive animation using any authoring tool.)
AIM:
To develop a program to perform Interactive animation using any authoring
tool(MacroMedia FLASH)
INTRODUCTION
2D animation statistics are shaped and/or shortened on the computer using 2D bitmap graphics
or shaped and shortened using 2D vector graphics. This includes programmed mechanized
versions of conventional animation techniques such as add something in piece of writing
gradually change, onion skin and add something in piece of writing decompose scoping. 2D
animation has many applications, with analogue computer cartoon, Flash
cartoon and PowerPoint cartoon Cinema graphs are still photographs in the appearance of
an animated GIF file of which part is animated.
a) How to Create 2D Animation Using Flash? Steps to implicate in creation of first simple animation by ‘Motion Tweening’.
1.Open Flash. If it is not on the start menu or on the desktop, you can find it on Computer at
Boot drive\Program Files\Macromedia\Flash 8.
WWW.VIDYARTHIPLUS.COM
2.Draw a shape. This will be what you animate.
WWW.VIDYARTHIPLUS.COM
3.Select the shape you have created with the "Selection Tool" and press "CTRL + F8".
4.The "Convert To Symbol" dialogue will appear, and you should select "Graphic". You
can name it, but that is not necessary.
WWW.VIDYARTHIPLUS.COM
4. Now click OK.
5. Go to the Timeline and click on frame 10.
WWW.VIDYARTHIPLUS.COM
6. Now right click frame 10 and select "Insert Frame".
WWW.VIDYARTHIPLUS.COM
8.Click on a frame between Frame 1 and Frame 10.
Right click on that selected frame and select "Create Motion Tween".
9.Now, go back to Frame 10 and select it. Change your "Graphic Symbol" in anyway you feel
like. You can use the Free Transform tool to make it smaller, larger, or drag it to a different place
on the stage.
WWW.VIDYARTHIPLUS.COM
Now, if you look at the timeline, a blue arrow should be in the empty frames between Frame 1
and 10. This means that a "Motion Tween" has been created and it will animate your symbol
from the position in Frame 1 to the position in Frame 2.
10. To test your animation, go back and select Frame 1 press "Enter" on your keyboard or
by selecting Control > Test Movie. Either way, the animation will appear and your symbol
should change the way you wanted it, by size, position or shape.
b)Procedure(Morphing)
1.Open flash5. Place object in the first frame of the time line ie., key frame
2.Place another object in the last frame of time line
3.Select each object separately and break it in to pixel using Edit->Break Apart
4.Hold the mouse pointer between two key frame and right click it then select motion tuning
5.Run the program by pressing CTRL+Entr
OUTPUT:
WWW.VIDYARTHIPLUS.COM
RESULT:
WWW.VIDYARTHIPLUS.COM
Thus the program to perform animation using flash software is performed and executed
successfully.