Ex 5
Ex 5
Scaling
Rotation
Reflection
Shearing
#include <graphics.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>
x[i] += tx;
y[i] += ty;
y[i] *= sy;
x[i] = x_new[i];
y[i] = y_new[i];
if (axis == 'x')
y[i] = -y[i];
x[i] = -x[i];
int main() {
char axis;
while (1) {
cleardevice();
drawTriangle(x, y);
scanf("%d", &choice);
switch (choice) {
case 1:
break;
case 2:
printf("Enter sx and sy: ");
break;
case 3:
scanf("%f", &angle);
rotate(x, y, angle);
break;
case 4:
reflect(x, y, axis);
break;
case 5:
break;
case 6:
closegraph();
return 0;
default:
} }
getch();
closegraph();
return 0;