/* Program to implement translation of line
#include<stdio.h>
#include <graphics.h>
#include <stdlib.h>
#include <conio.h>
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
int xmax, ymax,x1,y1,x2,y2,tx,ty;
initgraph(&gdriver, &gmode, “”);
printf(“Enter the X1 coordinate:\n”);
scanf(“%d”,&x1);
printf(“Enter the Y1 coordinate:\n”);
scanf(“%d”,&y1);
printf(“Enter the X2 coordinate:\n”);
scanf(“%d”,&x2);
printf(“Enter the Y2 coordinate:\n”);
scanf(“%d”,&y2);
line(x1,y1,x2,y2);
printf(“Enter the translation vector:\n”);
printf(“tx:”);
scanf(“%d”,&tx);
printf(“ty:”);
scanf(“%d”,&ty);
line(x1+tx,y1+ty,x2+tx,y2+ty);
getch();
closegraph();
return 0;
}
Latest posts by Mohit Arora (see all)
- MongoDB Operators Tutorial – What are Different Operators Available? - October 5, 2019
- MongoDB Projection Tutorial : Return Specific Fields From Query - March 9, 2019
- MongoDB Index Tutorial – Create Index & MongoDB Index Types - July 6, 2018