CG_10.docx

CG_10.docx - Name Aditya D Pharande STD SE Roll NO A-22...

This preview shows page 1 - 4 out of 9 pages.

/* Name : Aditya D. Pharande STD : SE. Roll NO. : A-22. */ // CODE #include<iostream> #include<math.h> #include<graphics.h> #include<stdlib.h> using namespace std; int main() { int tx,ty,sx,sy,x1,x2,x3,y1,y2,y3,nx1,nx2,nx3,ny1,ny2,ny3,shx,shy,c; float tx1; int gd=DETECT,gm=VGAMAX; initgraph(&gd,&gm,NULL); x1=100; y1=100; x2=200; y2=100; x3=150; y3=200; cout<<"\n Enter choice :- \n1 :Translation \n2 :Rotation \n3 :Scaling \n4 :Shear"; cout<<"\n Choice :"; cin>>c; switch(c) { case 1: cout<<"Enter tx & ty :"; cin>>tx>>ty;
Image of page 1

Subscribe to view the full document.

nx1=x1+tx; ny1=y1+ty; nx2=x2+tx; ny2=y2+ty; nx3=x3+tx; ny3=y3+ty; initgraph(&gd,&gm,NULL); setcolor(1); line(x1,y1,x2,y2); line(x2,y2,x3,y3); line(x3,y3,x1,y1); setcolor(WHITE); line(nx1,ny1,nx2,ny2); line(nx2,ny2,nx3,ny3); line(nx3,ny3,nx1,ny1); getch(); closegraph(); break; case 2: cout<<"Enter angle :"; cin>>tx1; tx1=tx1*(3.14/180); nx1=abs(x1*cos(tx1)-y1*sin(tx1)); ny1=abs(x1*sin(tx1)+y1*cos(tx1)); nx2=abs(x2*cos(tx1)-y2*sin(tx1)); ny2=abs(x2*sin(tx1)+y2*cos(tx1)); nx3=abs(x3*cos(tx1)-y3*sin(tx1));
Image of page 2
ny3=abs(x3*sin(tx1)-y3*cos(tx1)); initgraph(&gd,&gm,NULL); setcolor(1); line(x1,y1,x2,y2); line(x2,y2,x3,y3); line(x3,y3,x1,y1); setcolor(WHITE); line(nx1,ny1,nx2,ny2); line(nx2,ny2,nx3,ny3);
Image of page 3

Subscribe to view the full document.

Image of page 4
  • Fall '19
  • Trigraph, getch, closegraph, initgraph

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern