diff --git a/Answers/SUNIL RAUTELA_1951008 (CODE 1) b/Answers/SUNIL RAUTELA_1951008 (CODE 1) new file mode 100644 index 0000000..37fa0f5 --- /dev/null +++ b/Answers/SUNIL RAUTELA_1951008 (CODE 1) @@ -0,0 +1,37 @@ +#include +#include +int main( ) +{int gd=DETECT,gm; +int t[3][3]={1,0,0,0,1,0,0,0,1},a[3][3],r[3][3]={0},i,j,k; +printf("Enter value of x1 and y1: "); scanf("%d %d", &a[0][0], &a[0][1]); +printf("Enter value of x2 and y2: "); scanf("%d %d", &a[1][0], &a[1][1]); +printf("Enter value of x3 and y3: "); scanf("%d %d", &a[2][0], &a[2][1]); +printf("Enter value of tx and ty: "); scanf("%d %d", &t[2][0], &t[2][1]); +a[0][2]=a[1][2]=a[2][2]=1; +for(i=0;i<3;i++) +{ +for(j=0;j<3;j++) +{ +for(k=0;k<3;k++) +{ +r[i][j] = r[i][j] + (a[i][k]*t[k][j]); +} +} +} +initgraph(&gd,&gm,"NULL"); +line(a[0][0],a[0][1],a[1][0],a[1][1]); +line(a[1][0],a[1][1],a[2][0],a[2][1]); +line(a[0][0],a[0][1],a[2][0],a[2][1]); + +outtext("- - - Before Translation - - -"); +delay(5000); +cleardevice(); +line(r[0][0],r[0][1],r[1][0],r[1][1]); +line(r[1][0],r[1][1],r[2][0],r[2][1]); +line(r[0][0],r[0][1],r[2][0],r[2][1]); +outtext("- - - After Translation - - -"); +delay(5000); +closegraph( ); +return 0; + + } diff --git a/Answers/SUNIL RAUTELA_1951008 (CODE 2) b/Answers/SUNIL RAUTELA_1951008 (CODE 2) new file mode 100644 index 0000000..620f536 --- /dev/null +++ b/Answers/SUNIL RAUTELA_1951008 (CODE 2) @@ -0,0 +1,35 @@ +#include +#include +#include +void scaling(int x1,int y1,int x2,int y2,int x3,int y3) +{ +int sx,sy,xn1,yn1,xn2,xn3,yn3,yn2,gd=0,gm; printf("enter the scaling vector\n"); scanf("%d%d",&sx,&sy); xn1=x1*sx; +yn1=y1*sy; +xn2=x2*sx; +yn2=y2*sy; +xn3=x3*sx; +yn3=y3*sy; +initgraph(&gd,&gm,""); +setcolor(RED); +line(x1,y1,x2,y2); +setcolor(RED); +line(x1,y1,x3,y3); +setcolor(RED); +line(x2,y2,x3,y3); +delay(600); +setcolor(YELLOW); +line(xn1,yn1,xn2,yn2); +setcolor(YELLOW); +line(xn1,yn1,xn3,yn3); +setcolor(YELLOW); +line(xn2,yn2,xn3,yn3); +delay(600); +} +int main( ) +{ +int ch,x1,y1,x2,y2,x3,y3; +printf("enter the vertex co-ordinates of triangle\n"); +scanf("%d %d %d %d %d %d",&x1,&y1,&x2,&y2,&x3,&y3); scaling(x1,y1,x2,y2,x3,y3); +delay(9999); +return 0; +} diff --git a/Answers/output1aa (2).PNG b/Answers/output1aa (2).PNG new file mode 100644 index 0000000..c364962 Binary files /dev/null and b/Answers/output1aa (2).PNG differ diff --git a/Answers/output1aa.PNG b/Answers/output1aa.PNG new file mode 100644 index 0000000..86f925a Binary files /dev/null and b/Answers/output1aa.PNG differ diff --git a/Answers/output2.PNG b/Answers/output2.PNG new file mode 100644 index 0000000..aaab75b Binary files /dev/null and b/Answers/output2.PNG differ