Code Competitions

Coding competition
Showing posts with label Rotation Transformation w.r.t. fixed point.. Show all posts
Showing posts with label Rotation Transformation w.r.t. fixed point.. Show all posts

Tuesday, 14 May 2013

To perform Rotation Transformation on figure w.r.t. fixed point.



#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include "z:\headr.h"
int v[3][3];
int r[3][3];
float rt[3][3];
float rt1[3][3];
float rt2[3][3];

void main()
{
  int gd = DETECT, gm;
  initgraph(&gd, &gm, "");
  vm(v);
  tdsp(v);
  getch();
 // ROTATION WITH RESPECT TO A POINT
  setcolor(4);                  
  trans(-v[0][0], -v[0][1], r);
  rotate(30, rt);
  matmul(r, rt, rt1);
  matmul(rt1, v, rt2);
  tdsp(rt2);
  getch();
  closegraph();
}

    OUTPUT: