Friday, 6 September 2013

Contents For Literature And Visual Arts


download link:

https://drive.google.com/folderview?id=0Bwg3njtIKmGXeFo1VjdhMWhmZW8&usp=sharing

Monday, 26 August 2013

For the section (K1002)
this is ur group address.. 
https://www.facebook.com/groups/K1002/
students of this section can add themselves for every latest Info
#LPUstudents

Thursday, 8 August 2013

7th Sem Ebooks




















link:

https://drive.google.com/folderview?id=0Bwg3njtIKmGXQTNXUnFhUXczWDA&usp=sharing

Friday, 29 March 2013



Program for Polygon Clipping Using c 




#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
void clip(float,float,float);
int i,j=0,n;
int rx1,rx2,ry1,ry2;
float x1[8],y1[8];
void main()
{
int gd=DETECT,gm;
int i,n;
float x[8],y[8],m;
clrscr();
initgraph(&gd,&gm,"");
printf("coordinates for rectangle : ");
scanf("%d%d%d%d",&rx1,&ry1,&rx2,&ry2);
printf("no. of sides for polygon : ");
scanf("%d",&n);
printf("coordinates : ");
for(i=0;i<n;i++)
{
scanf("%f%f",&x[i],&y[i]);
}
cleardevice();
outtextxy(10,10,"Before clipping");
outtextxy(10,470,"Press any key....");
rectangle(rx1,ry1,rx2,ry2);
for(i=0;i<n-1;i++)
line(x[i],y[i],x[i+1],y[i+1]);
line(x[i],y[i],x[0],y[0]);
getch();
cleardevice();
for(i=0;i<n-1;i++)
{
m=(y[i+1]-y[i])/(x[i+1]-x[i]);
clip(x[i],y[i],m);
clip(x[i+1],y[i+1],m);
}
m=(y[i]-y[0])/(x[i]-x[0]);
clip(x[i],y[i],m);
clip(x[0],y[0],m);
outtextxy(10,10,"After clipping");
outtextxy(10,470,"Press any key....");
rectangle(rx1,ry1,rx2,ry2);
for(i=0;i<j-1;i++)
line(x1[i],y1[i],x1[i+1],y1[i+1]);
getch();
}

void clip(float e,float f,float m)
{
while(e<rx1 || e>rx2 || f<ry1 || f>ry2)
{
if(e<rx1)
{
f+=m*(rx1-e);
e=rx1;
}
else if(e>rx2)
{
f+=m*(rx2-e);
e=rx2;
}
if(f<ry1)
{
e+=(ry1-f)/m;
f=ry1;
}
else if(f>ry2)
{
e+=(ry2-f)/m;
f=ry2;
}
}
x1[j]=e;
y1[j]=f;
j++;
}

Saturday, 23 March 2013


Cohen Sutherland Line Clipping Algorithm in C Program



#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
void clip(float,float,float);
int i,j=0,n;
int rx1,rx2,ry1,ry2;
float x1[8],y1[8];
void main()
{
int gd=DETECT,gm;
int i,n;
float x[8],y[8],m;
clrscr();
initgraph(&gd,&gm,"");
printf("coordinates for rectangle : ");
scanf("%d%d%d%d",&rx1,&ry1,&rx2,&ry2);
printf("no. of sides for polygon : ");
scanf("%d",&n);
printf("coordinates : ");
for(i=0;i<n;i++)
{
scanf("%f%f",&x[i],&y[i]);
}
cleardevice();
outtextxy(10,10,"Before clipping");
outtextxy(10,470,"Press any key....");
rectangle(rx1,ry1,rx2,ry2);
for(i=0;i<n-1;i++)
line(x[i],y[i],x[i+1],y[i+1]);
line(x[i],y[i],x[0],y[0]);
getch();
cleardevice();
for(i=0;i<n-1;i++)
{
m=(y[i+1]-y[i])/(x[i+1]-x[i]);
clip(x[i],y[i],m);
}
clip(x[0],y[0],m);
outtextxy(10,10,"After clipping");
outtextxy(10,470,"Press any key....");
rectangle(rx1,ry1,rx2,ry2);
for(i=0;i<j-1;i++)
line(x1[i],y1[i],x1[i+1],y1[i+1]);
getch();
}

void clip(float e,float f,float m)
{
while(e<rx1 e>rx2 f<ry1 f>ry2)
{
if(e<rx1)
{
f+=m*(rx1-e);
e=rx1;
}
else if(e>rx2)
{
f+=m*(rx2-e);
e=rx1;
}
if(f<ry1)
{
e+=(ry1-f)/m;
f=ry1;
}
else if(f>ry2)
{
e+=(ry2-f)/m;
f=ry2;
}
x1[j]=e;
y1[j]=f;
j++;
}
}

OUTPUT

Enter the x1 & y1 coordinates:
X1 : 70
Y1 : 80
Enter the x2 & y2 coordinates:
X2 : 250
Y2 : 280

Cohen Sutherland Line Clipping Algorithm  computer Graphics Lab

Saturday, 2 March 2013

Rotation of Circle


#include<stdio.h>
#include<graphics.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
#include<math.h>
#include<iostream.h>
main()
{
int gd=DETECT,gm,x=295,y=222,a,j,i;
initgraph(&gd,&gm,"..//bgi");
setcolor(14);
outtextxy(x-60,y,"FIRST SOFT TECH");
while(!kbhit())
{
i++;

delay(1);
setcolor(16);
circle(x+(200*cos(i)),y+(200*sin(i)),8);
setcolor(10);
circle(x+(200*cos(i+40)),y+(200*sin(i+40)),8);
//set2
setcolor(16);
circle(x+(160*sin(i)),y+(160*cos(i)),7); //anti clockwise:-sin,cosinterchanged
circle(x+(160*sin(i)),y+(160*cos(i)),5);
setcolor(i);
circle(x+(160*sin(i+40)),y+(160*cos(i+40)),7);
circle(x+(160*sin(i+40)),y+(160*cos(i+40)),5);

setcolor(16);
circle(x+(120*sin(i)),y+(120*cos(i)),6);//anti clockwise:-sin,cosinterchanged
setcolor(12);
circle(x+(120*sin(i+40)),y+(120*cos(i+40)),6);

setcolor(16);
circle(x+(90*cos(i)),y+(90*sin(i)),5);
setcolor(i);
circle(x+(90*cos(i+40)),y+(90*sin(i+40)),5);
}
getch();
return 0;
}

Shearing of 2D object


#include"2dframe.CPP"
#include<iostream.h>

void shear_rectangle(int ,int,int ,int ,float );
void main()
{
    int gd=DETECT,gm;
    initgraph(&gd,&gm,"c:\\tc\\bgi");
    cout<<"\nEnter Your 2D-Frame Length:\n";
    cout<<"\nANY VALUE  BETWEEN 1000 - 30000:";
    cin>>frame_length;
    int x_start=0,y_start=0,length_x,breadth_y;
    cout<<"\nEnter the Start point of the rectangle\n";
    cin>>x_start>>y_start;
    cout<<"\nEnter length,breadth of Rectagle:\n";
    cin>>length_x ;
    cin>>breadth_y;
    DRAW2DFRAME();
    //CREATE THE RECTANGLE
    rectangle2d(x_start,y_start,length_x,breadth_y);
    getch();
    cleardevice();
    float sh;
    cout<<"\nFor this Rectangle : ";
    cout<<"\nMAX Range Of Shear factor along Y-axis=0.0 TO\t ";
    cout<<(frame_length/breadth_y);
    cout<<"\nEnter the shear factors:sh\n";
    cin>>sh;
    DRAW2DFRAME();
    outtextxy(25,40,"Before Shear");
    rectangle2d(x_start,y_start,length_x,breadth_y);
    getch();
    DRAW2DFRAME();
    outtextxy(25,40,"After Shear");
    shear_rectangle(x_start,y_start,length_x,breadth_y,sh);
    getch();
    closegraph();

}

void shear_rectangle
(int x,int y,int length_x,int breadth_y,float sh)
{
     int arr1[2],arr2[2],arr3[2],arr4[2];
     int X1,Y1,X2,Y2;
     int x1,y1,x2,y2;
     ///////////////////////////////////////////////////////////////////
     x1=x,y1=y;
     x2=x1,y2=y1+breadth_y;
     shear_point_Y(x1,y1,sh);
     X1=P1[0][0];
     Y1=P1[0][1];
     shear_point_Y(x2,y2,sh);
     X2=P1[0][0];
     Y2=P1[0][1];
     line2d(X1,Y1,X2,Y2,arr1,arr2,YELLOW);
     //*******************************************************************
     //*******************************************************************
     x1=x+length_x;y1=y;
     x2=x+length_x,y2=y+breadth_y;
     shear_point_Y(x1,y1,sh);
     X1=P1[0][0];
     Y1=P1[0][1];
     shear_point_Y(x2,y2,sh);
     X2=P1[0][0];
     Y2=P1[0][1];
     line2d(X1,Y1,X2,Y2,arr1,arr2,GREEN);
     //****************************************************************
     //****************************************************************
     x1=x,y1=y;
     x2=x+length_x,y2=y1;
     shear_point_Y(x1,y1,sh);
     X1=P1[0][0];
     Y1=P1[0][1];
     shear_point_Y(x2,y2,sh);
     X2=P1[0][0];
     Y2=P1[0][1];
     line2d(X1,Y1,X2,Y2,arr1,arr2,LIGHTBLUE);
     //*******************************************************************
     //*******************************************************************
     x1=x,y1=y+breadth_y;
     x2=x+length_x,y2=y+breadth_y;
     shear_point_Y(x1,y1,sh);
     X1=P1[0][0];
     Y1=P1[0][1];
     shear_point_Y(x2,y2,sh);
     X2=P1[0][0];
     Y2=P1[0][1];
     line2d(X1,Y1,X2,Y2,arr1,arr2,MAGENTA);
     ///////////////////////////////////////////////////////////////////
     //******************************************************************
     //******************************************************************
}

Friday, 22 February 2013


To perform 2D transformations such as translation, scaling, and  rotation  on 2D object

ALGORITHM:
1.      Start
2.      Initialize the graphics mode.
3.      Construct a 2D object  (use Drawpoly()) e.g. (x,y)
4.      A) Translation
a.       Get the translation value tx, ty
b.      Move the 2d object with tx, ty (x’=x+tx,y’=y+ty)
c.       Plot (x’,y’)
5.      B)  Scaling
a.       Get the scaling value Sx,Sy
b.       Resize the object with Sx,Sy  (x’=x*Sx,y’=y*Sy)
c.       Plot (x’,y’)
6.      C) Rotation
a.       Get the Rotation angle
b.      Rotate the object by the angle Ñ„
                    x’=x cos Ñ„ -  y sin Ñ„
                                      y’=x sin Ñ„  - y cosÑ„  
c.       Plot (x’,y’)

PROGRAM:


#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<math.h>
void main()
{
            int gm;
            int gd=DETECT;
            int x1,x2,x3,y1,y2,y3,nx1,nx2,nx3,ny1,ny2,ny3,c;
            int sx,sy,xt,yt,r;
            float t;
            initgraph(&gd,&gm,"c:\tc\bg:");
            printf("\t Program for basic transactions");
            printf("\n\t Enter the points of triangle");
            setcolor(1);
            scanf("%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3);
            line(x1,y1,x2,y2);
            line(x2,y2,x3,y3);
            line(x3,y3,x1,y1);
            getch();
            printf("\n 1.Transaction\n 2.Rotation\n 3.Scalling\n 4.exit");
            printf("Enter your choice:");
            scanf("%d",&c);
            switch(c)
            {
                        case 1:
                                    printf("\n Enter the translation factor");
                                    scanf("%d%d",&xt,&yt);
                                    nx1=x1+xt;
                                    ny1=y1+yt;
                                    nx2=x2+xt;
                                    ny2=y2+yt;
                                    nx3=x3+xt;
                                    ny3=y3+yt;
                                    line(nx1,ny1,nx2,ny2);
                                    line(nx2,ny2,nx3,ny3);
                                    line(nx3,ny3,nx1,ny1);
                                    getch();

                        case 2:
                                    printf("\n Enter the angle of rotation");
                                    scanf("%d",&r);
                                    t=3.14*r/180;
                                    nx1=abs(x1*cos(t)-y1*sin(t));
                                    ny1=abs(x1*sin(t)+y1*cos(t));
                                    nx2=abs(x2*cos(t)-y2*sin(t));
                                    ny2=abs(x2*sin(t)+y2*cos(t));
                                    nx3=abs(x3*cos(t)-y3*sin(t));
                                    ny3=abs(x3*sin(t)+y3*cos(t));
                                    line(nx1,ny1,nx2,ny2);
                                    line(nx2,ny2,nx3,ny3);
                                    line(nx3,ny3,nx1,ny1);
                                    getch();

                        case 3:
                                    printf("\n Enter the scalling factor");
                                    scanf("%d%d",&sx,&sy);
                                    nx1=x1*sx;
                                    ny1=y2*sy;
                                    nx2=x2*sx;
                                    ny2=y2*sy;
                                    nx3=x3*sx;
                                    ny3=y3*sy;
                                    line(nx1,ny1,nx2,ny2);
                                    line(nx2,ny2,nx3,ny3);
                                    line(nx3,ny3,nx1,ny1);
                                    getch();

                        case 4:
                                    break;
                        default:
                                    printf("Enter the correct choice");
                                    }
                                    closegraph();
                                    }

BOUNDARY FILL PROGRAM IN C


#include<stdio.h>
#include<conio.h>
#include<graphics.h>

void boundaryfill(int,int,int,int);
int main()
{
  int xc,yc,r,fc,bc;
  int gd=DETECT,gm;
  initgraph(&gd,&gm," ");
  printf("\n\n Enter xc:");
  scanf("%d",&xc);
  printf("\n\n Enter yc:");
  scanf("%d",&yc);
  printf("\n\n Enter r:");
  scanf("%d",&r);
  setcolor(8);
  circle(xc,yc,r);
  printf("\n\n Enter fill color:");
  scanf("%d",&fc);
  printf("\n\n Enter Boundary Color");
  scanf("%d",&bc);
 
  boundaryfill(xc,yc,fc,bc);
  getch();
  closegraph();
  return 0;
}



void boundaryfill(int x1,int y1,int fc1,int bc1)
{
  int current;
  current=getpixel(x1,y1);
  printf("\n\n %d",current);
  if((current !=bc1) && (current != fc1))
  {
     setcolor(fc1);
     putpixel(x1,y1,9);
     boundaryfill(x1+1,y1,fc1,bc1);
     boundaryfill(x1-1,y1,fc1,bc1);
     boundaryfill(x1,y1+1,fc1,bc1);
     boundaryfill(x1,y1-1,fc1,bc1);
   }
}
FLOODFILL PROGRAM IN C



#include<conio.h>
#include<stdio.h>
#include<graphics.h>
#include<dos.h>

void fill_right(x,y)
int x , y ;
{
if(getpixel(x,y) == 0)
{
putpixel(x,y,RED);
fill_right(++x,y);
x = x - 1 ;
fill_right(x,y-1);
fill_right(x,y+1);

}
}

void fill_left(x,y)
int x , y ;
{
if(getpixel(x,y) == 0)
{
putpixel(x,y,RED);

fill_left(--x,y);
x = x + 1 ;
fill_left(x,y-1);
fill_left(x,y+1);

}
}


void main()
{
int x , y ,a[10][10];
int gd, gm ,n,i;

detectgraph(&gd,&gm);
initgraph(&gd,&gm,"c:\\tc\\bgi");

printf("\n\n\tEnter the no. of edges of polygon : ");
scanf("%d",&n);
printf("\n\n\tEnter the cordinates of polygon :\n\n\n ");

for(i=0;i<n;i++)
{
printf("\tX%d Y%d : ",i,i);
scanf("%d %d",&a[i][0],&a[i][1]);
}

a[n][0]=a[0][0];
a[n][1]=a[0][1];

printf("\n\n\tEnter the seed pt. : ");
scanf("%d%d",&x,&y);


cleardevice();
setcolor(WHITE);

for(i=0;i<n;i++) /*- draw poly -*/
{
line(a[i][0],a[i][1],a[i+1][0],a[i+1][1]);
}

fill_right(x,y);
fill_left(x-1,y);

getch();
}

/*SAMPLE INPUT*/
/*Enter the number of edges of polygon 4

X0 Y0 = 50 50
X1 Y1 = 200 50
X2 Y2 = 200 300
X3 Y3 = 50 300

Enter the seed point 100 100*/

Tuesday, 5 February 2013


Mid-Point Ellipse Drawing Program in C

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <time.h>
#include <dos.h>

int main(void)
{
int gd=DETECT,gm;
int cenx,ceny;
float Pk,a,b,x,y;
clrscr();

printf("\n\n Enter 'a' and 'b': ");
scanf("%f%f",&a,&b);

initgraph(&gd,&gm,"c:\\tc\\bgi");


cenx=getmaxx()/2;
ceny=getmaxy()/2;

Pk=b*b-b*a*a+0.25*a*a;
x=0;
y=b;
putpixel(cenx+x,ceny+y,WHITE);
putpixel(cenx+x,ceny-y,WHITE);
putpixel(cenx-x,ceny+y,WHITE);
putpixel(cenx-x,ceny-y,WHITE);

while (2*x*b*b <= 2*y*a*a)
{
if (Pk<0)
{
x=x+1;
y=y;
Pk=Pk+2*x*b*b+3*b*b;
}
else
{
x=x+1;
y=y-1;
Pk=Pk+2*x*b*b+3*b*b-2*y*a*a+2*a*a;
}
putpixel(cenx+x,ceny+y,WHITE);
putpixel(cenx+x,ceny-y,WHITE);
putpixel(cenx-x,ceny+y,WHITE);
putpixel(cenx-x,ceny-y,WHITE);
delay(40);
}


Pk=(x+0.5)*(x+0.5)*b*b+(y-1)*(y-1)*a*a-a*a*b*b;
putpixel(cenx+x,ceny+y,WHITE);
putpixel(cenx+x,ceny-y,WHITE);
putpixel(cenx-x,ceny+y,WHITE);
putpixel(cenx-x,ceny-y,WHITE);
while (y>0)
{
if (Pk>0)
{
x=x;
y=y-1;
Pk=Pk-2*y*a*a+3*a*a;
}
else
{
x=x+1;
y=y-1;
Pk=Pk-2*y*a*a+3*a*a+2*x*b*b+2*b*b;
}
putpixel(cenx+x,ceny+y,WHITE);
putpixel(cenx+x,ceny-y,WHITE);
putpixel(cenx-x,ceny+y,WHITE);
putpixel(cenx-x,ceny-y,WHITE);
delay(40);
}
gotoxy(1,25);
printf ("\npress any key to exit.");
getch();
closegraph();
return 0;
}
/*SAMPLE INPUT*/

/*Enter 'a' and 'b' 120 80*/

Midpoint Circle Drawing Program in C

#include<stdio.h>
#include<graphics.h>
#include<math.h>

void midptcircle(int xcen,int ycen,int radius)
{
int x=0;
int y=radius;
int p=1-radius;
void plotpoints(int,int,int,int);
plotpoints(xcen,ycen,x,y);
while(x<y)
{
x++;
if(p<0)
p+=2*x+1;
else
{
y--;
p+=2*(x-y)+1;
}
plotpoints(xcen,ycen,x,y);
}
}

void plotpoints(int xcen,int ycen,int x,int y)
{
putpixel(xcen+x,ycen+y,RED);
putpixel(xcen-x,ycen+y,RED);
putpixel(xcen+x,ycen-y,RED);
putpixel(xcen-x,ycen-y,RED);
putpixel(xcen+y,ycen+x,RED);
putpixel(xcen-y,ycen+x,RED);
putpixel(xcen+y,ycen-x,RED);
putpixel(xcen-y,ycen-x,RED);
}

int main()
{
int xcen,ycen,radius;
int gd=DETECT,gm;
clrscr();

printf("Enter centre of circle: ");
scanf("%d%d",&xcen,&ycen);
printf("\nEnter radius: ");
scanf("%d",&radius);
initgraph(&gd,&gm,"");
midptcircle(xcen,ycen,radius);
getch();
return 0;
}

Friday, 1 February 2013

BRESENHAMS CIRCLE DRAWING USING C

# include<stdio.h>
# include<conio.h>
# include<graphics.h>
# include<math.h>

void main()
{
int gd=DETECT,gm;
int r,x,y,p,xc=320,yc=240;

initgraph(&gd,&gm,"C:\\TC\\BGI");
cleardevice();


printf("Enter the radius ");
scanf("%d",&r);


x=0;
y=r;
putpixel(xc+x,yc-y,1);

p=3-(2*r);

for(x=0;x<=y;x++)
{
if (p<0)
{
y=y;
p=(p+(4*x)+6);
}
else
{
y=y-1;

p=p+((4*(x-y)+10));
}

putpixel(xc+x,yc-y,1);
putpixel(xc-x,yc-y,2);
putpixel(xc+x,yc+y,3);
putpixel(xc-x,yc+y,4);
putpixel(xc+y,yc-x,5);
putpixel(xc-y,yc-x,6);
putpixel(xc+y,yc+x,7);
putpixel(xc-y,yc+x,8);

}
getch();
closegraph();
}
BRESENHAMS LINE DRAWING USING C

# include <stdio.h>
# include <conio.h>
# include <graphics.h>

void main()
{
int dx,dy,x,y,p,x1,y1,x2,y2;
int gd,gm;

clrscr();

printf("\n\n\tEnter the co-ordinates of first point : ");
scanf("%d %d",&x1,&y1);
printf("\n\n\tEnter the co-ordinates of second point : ");
scanf("%d %d",&x2,&y2);

dx = (x2 - x1);
dy = (y2 - y1);

p = 2 * (dy) - (dx);

x = x1;
y = y1;

detectgraph(&gd,&gm);
initgraph(&gd,&gm,"e:\\tc\\bgi");
putpixel(x,y,WHITE);

while(x <= x2)
{
if(p < 0)
{
x=x+1;
y=y;
p = p + 2 * (dy);
}
else
{
x=x+1;
y=y+1;
p = p + 2 * (dy - dx);
}
putpixel(x,y,WHITE);
}
getch();
closegraph();

}
DDA LINE DRAWING USING C

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void DDA(int x1,int y1,int x2,int y2,int col,int del);
void main()
{
int gd=DETECT,gm,x1,x2,y1,y2;
initgraph(&gd,&gm,"");
printf("Enter (x1,y1) and (x2,y2) : ");
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
DDA(x1,y1,x2,y2,14,20);
getch();
closegraph();
}
void DDA(int x1,int y1,int x2,int y2,int col,int del)
{
int dx,dy,s,i,xi,yi,x,y;
x=x1,y=y1;
dx=x2-x1;
dy=y2-y1;
if(dx>dy)
s=dx;
else
s=dy;
xi=dx/s;
yi=dy/s;
putpixel(x,y,col);
for(i=0;i<s;i++)

{
x+=xi;
y+=yi;

putpixel(x,y,col);
delay(del);

}
}

Wednesday, 30 January 2013

Monday, 21 January 2013

Sports Meet Event On 9th and 10th of Feb..
Give your name to the faculties according to your choices..


Activate Office 365 - 2019 Version

                        Link to install office 365 https://windowsedition.com/download-office-365-offline-installer-iso/ Follow the bel...