C program to tramsform 2D objects.

Posted by Mangesh on May 03, 2018

/* program for transforming 2D object. */

Description :

Transforming a 2D object from one location to another can be done by adding the transforming factors to actual coordinates.

Program :

void main() {
   int gdriver = DETECT, gmode;
   int point[] = {50,50,50,200,200,200,50,50};
   int i,sx,sy;
   initgraph(&gdriver, &gmode, "c:\\turboc3\\bgi");
   printf("\n\nEnter the transform factor of X - axis : ");
   printf("Enter the transform factor of Y - axis : ");

       point[i] = point[i] + sx;
       point[i] = point[i] + sy;

Output :

 c program for transform 2d object output Executed and tested in Turbo C 3.2

Written with from Mangesh.

Related Post
1 C program for scaling of 2D object.
2 C program to tramsform 2D objects.
3 C program to draw a line.
4 C program to draw a circle.
5 C program to draw a rectangle.
6 C program for DDA algorithm to generate line.
7 C program for midpoint circle algorithm.
Latest Post
1 C program to implement Queue using linked list.
2 C program for binary search tree (BST).
3 C program to search an element in linked list.
4 C program for postorder traversal in binary tree.
5 C program for preorder traversal in binary tree.