void main() { int gd=DETECT,gm, x1, x2, x3, y1, y2, y3, p, mx, my, sx, sy, choice; clrscr(); initgraph(&gd,&gm,"c:\\tc\\bgi"); mx = getmaxx()/2; my = getmaxy()/2; setcolor(3); line( 0, my, getmaxx(), my ); line( mx, 0, mx, getmaxy() ); printf("Enter coordinates of 1st vertex of triangle: "); scanf("%d %d",&x1,&y1); printf("Enter coordinates of 2nd vertex of triangle: "); scanf("%d %d",&x2,&y2); printf("Enter coordinates of 3rd vertex of triangle: "); scanf("%d %d",&x3,&y3); printf("Enter the operation to be carried out?\n1. Reflection about x axis.\n2.Reflection about y axis.\n3.shearing\n"); printf("Choice: "); scanf("%d",&choice); while( choice < 4 && choice > 0 ){ switch( choice ){ case 1: reflection_x( x1, x2, x3, y1, y2, y3, mx, my); break; case 2: reflection_y( x1, x2, x3, y1, y2, y3, mx, my); break; case 3: printf("Enter value of shearing in x and y: "); scanf("%d%d",&sx,&sy); shearing( x1, x2, x3, y1, y2, y3, mx, my, sx, sy); break; } printf("Choice: "); scanf("%d",&choice); } closegraph(); }
Transform Transform::shearing( const Vector2d& factors ) { return shearing(factors.x, factors.y); }