//shearing

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
int x1,y1,x2,y2,x,y,x3,y3,x4,y4,ch;
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
clrscr();
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
do
{
cout<<" #############MAIN-MENU###############\n";
cout<<" SHEARING\n";
cout<<" 1.LINE\n";
cout<<" 2.RECTANGLE\n";
cout<<" 3.TRIANGLE\n";
cout<<"enter your choice:0 for exit:\n";
cin>>ch;
switch(ch)
{
case 1: cout<<"enter the values of line coordinates:";
cin>>x1>>y1>>x2>>y2;
cout<<"enter the value of shearing for xaxis:";
cin>>x;
cout<<"enter the value of shearing for y-axis:";
cin>>y;
cleardevice();
line(x1,y1,x2,y2);
cout<<"now hit a key to see shear in x_axis:";
getch();
line(x1,y1,x2*x,y2);
cout<<"\nnow hit a key to see shear in y_axis:";
getch();
line(x1,y1,x2,y2*y);
break;

case 2: cout<<"enter the top left coordinates:";
cin>>x1>>y1;
cout<<"enter the bottom right coordinates:";
cin>>x2>>y2;
cout<<"enter the values of shearing coordinate for x_shear:\n";
cin>>x;
cout<<"enter the values of shearing coordinate for y_shear:\n";
cin>>y;

cleardevice();
rectangle(x1,y1,x2,y2);
cout<<"now hit a key to see shear in x_axis:";
getch();
rectangle(x1,y1,x2*x,y2);
cout<<"\nnow hit a key to see shear in y_axis:";
getch();
rectangle(x1,y1,x2,y2*y);
break;
case 3: cout<<"enter coordinates of line1:\n";
cin>>x1>>y1>>x2>>y2;
cout<<"enter coordinates for relative line:\n";
cin>>x3>>y3;
cout<<"enter shear coordinate for x_shear:\n";cin>>x;
cout<<"enter shear coordinate for y_shear:\n";cin>>x;

cleardevice();
line(x1,y1,x2,y2);
moveto(x2,y2);
lineto(x3,y3);
moveto(x3,y3);
lineto(x1,y1);
cout<<"\nnow hit a key to see shear in x_axis:";
getch();
moveto(x1,y1);
lineto(x2*x,y2);
moveto(x2*x,y2);
lineto(x3*x,y3);
moveto(x3*x,y3);
lineto(x1,y1);
cout<<"\nnow hit a key to see shear in y_axis:";
getch();
moveto(x1,y1);
lineto(x2,y2*y);
moveto(x2,y2*y);
lineto(x3,y3*y);
moveto(x3,y3*y);
lineto(x1,y1);
break;
case 0: break;
default:cout<<"invalid choice";break;
}}while(ch!=0);
getch();
closegraph();
}

Home      |      About Us      |     Portfolio      |      Services      |      Courses      |     Career      |      Cost      |      Contact Us
Services
  SEO   
  Link Building
  Data Entry
  Web Design and development
  Web Application development
 

Graphic and multimedia

  E-Commerce Solutions
  Software development
  Web Marketing & Promoting
  Internet Marketing
  IT Outsourcing
  Multimedia/CD Presentation
  Synopsis Ideas
  Project Ideas
  Placement Papers
  Live Project Training
  Programming & Projects
  Faq
  Training @balujalabs
 
 
Method
 

Write a program to Implement Shearing?

 

 

 

 

 

 

 

 

 

                                                                                                                                          

1 Write a program to draw a line using DDA line algorithm?
2 Write a program to draw a line using Bresonhams line drawing algorithm?
3 Write a program to draw a circle using Bresenham circle drawing algorithm?
4 Write a program to draw a circle using Midpoint circle drawing algorithm.
5 Write a program to draw a ellipse using Midpoint circle drawing algorithm.
6 Write a program to Implement Translation?
7 Write a program to Implement Rotation?
8 Write a program to Implement Shearing?
9 Write a program to Implement CotenSuther Land clipping algorithm?
10 Write a program to implement polygon clipping?