Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Name : Jay Gaikwad

Roll no. : 62

PRACTICAL NO. 7

Q.1. Write a program for 2D Transformations Scaling.

INPUT :

#include<stdio.h>

#include<graphics.h>

void main()

int gd=DETECT,gm;

int x1=100,y1=100,x2=300,y2=300,tx,ty,x3,y3,x4,y4;

initgraph(&gd,&gm,"C:\\TURBOC3\\BIN");

rectangle(x2,y1,x2,y2);

printf("Enter tx And ty \n");

scanf("%d%d",&tx,&ty);

x3=x1*tx;

y3=y1*ty;

x4=x2*tx;

y4=y2*ty;

rectangle(x3,y3,x4,y4);

getch();

closegraph();

}
OUTPUT :

Q.2. Write a program for 2D Transformations Translaction.


INPUT :

#include<stdio.h>

#include<graphics.h>

void main()

int gd=DETECT,gm;

int x1=100,y1=100,x2=300,y2=300,tx,ty,x3,y3,x4,y4;

initgraph(&gd,&gm,"C:\\TURBOC3\\BIN");

rectangle(x2,y1,x2,y2);

printf("Enter tx And ty \n");

scanf("%d%d",&tx,&ty);

x3=x1*tx;

y3=y1*ty;

x4=x2*tx;

y4=y2*ty;

rectangle(x3,y3,x4,y4);

getch();

closegraph();

OUTPUT :

You might also like