/*
2D Translation
*/
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
int i;
int x2,y2,x1,y1,x,y;
clrscr();
printf("Enter the 2 line end points:");
printf("\n\n x1,y1,x2,y2: ");
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
printf("Enter translation co-ordinates x,y:");
scanf("%d%d",&x,&y);
initgraph(&gd,&gm,"c:\\turboc3\\bgi");
outtextxy(x1,y1-20,"Original Line ->");
line(x1,y1,x2,y2);
x1=x1+x;
y1=y1+y;
x2=x2+x;
y2=y2+y;
outtextxy(x1,y1-20,"After Translate Line -> ");
line(x1,y1,x2,y2);
getch();
closegraph();
}
2D Translation
*/
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
int i;
int x2,y2,x1,y1,x,y;
clrscr();
printf("Enter the 2 line end points:");
printf("\n\n x1,y1,x2,y2: ");
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
printf("Enter translation co-ordinates x,y:");
scanf("%d%d",&x,&y);
initgraph(&gd,&gm,"c:\\turboc3\\bgi");
outtextxy(x1,y1-20,"Original Line ->");
line(x1,y1,x2,y2);
x1=x1+x;
y1=y1+y;
x2=x2+x;
y2=y2+y;
outtextxy(x1,y1-20,"After Translate Line -> ");
line(x1,y1,x2,y2);
getch();
closegraph();
}