Professional Documents
Culture Documents
SE COMPS A
Roll No. 07
Exiperiment No : 09
Aim: To implement 2D transformation:
1. Translation
2. Scaling
3. Rotation
4. Reflection
5. Shear
1. Translation:
Code:
Output:
2. Scaling:
Code:
// C program to demonstrate scaling of abjects
#include<stdio.h>
#include<graphics.h>
p[0][0] = temp[0][0];
p[1][0] = temp[1][0];
}
findNewCoordinate(s, p);
x[i] = p[0][0];
y[i] = p[1][0];
}
// Driven Program
int main()
{
int x[] = { 100, 200, 300 };
int y[] = { 200, 100, 200 };
int sx = 2, sy = 2;
scale(x, y, sx,sy);
getch();
return 0;
}
Output:
3. Rotation:
Code:
Output:
4. Reflection:
Code:
Output:
5. Shear:
Code:
Output: