资源简介

计算机图形学二维图形的变换 计算机图形学二维图形的变换 TC

资源截图

代码片段和文件信息

#include
#include
#include
#include
#define XC   300  
#define YC   300   
           
void main(){

int gdrivergmode;
int coor1[10]={0051510301515200}; int i; int xy;
int gxl[10]={0051510301515200};
int gxl1[10]={0051510301515200};
int gxl2[10]={0051510301515200};
int gxl3[10]={0051510301515200};
int gxl4[10]={0051510301515200};

detectgraph(&gdriver&gmode);
initgraph(&gdriver&gmode“C:\\TURBOC2“);
  
 setcolor(WHITE);
 line(100YC500YC);
 line(XC100XC450);
 line(500300495295);
 line(500300495305);
 line(300100295105);
 line(300100305105);   
 line(XC+coor1[0]YC-coor1[1]XC+coor1[2]YC-coor1[3]); 
 line(XC+coor1[2]YC-coor1[3]XC+coor1[4]YC-coor1[5]);
 line(XC+coor1[4]YC-coor1[5]XC+coor1[6]YC-coor1[7]);
 line(XC+coor1[6]YC-coor1[7]XC+coor1[8]YC-coor1[9]);
 line(XC+coor1[2]YC-coor1[3]XC+coor1[6]YC-coor1[7]);

  for(i=0;i<5;i++)
  {
  gxl[2*i]=coor1[2*i]+52;
  gxl[2*i+1]=coor1[2*i+1]+69;
  }
 line(XC+gxl[0]YC-gxl[1]XC+gxl[2]YC-gxl[3]); 
 line(XC+gxl[2]YC-gxl[3]XC+gxl[4]YC-gxl[5]);
 line(XC+gxl[4]YC-gxl[5]XC+gxl[6]YC-gxl[7]);
 line(XC+gxl[6]YC-gxl[7]XC+gxl[8]YC-gxl[9]);
 line(XC+gxl[2]YC-gxl[3]XC+gxl[6]YC-gxl[7]);

getch();
clearviewport();

 line(100YC500YC);
 line(XC100XC450);
 line(500300495295);
 line(500300495305);
 line(300100295105);
 line(300100305105);  
 line(XC+coor1[0]YC-coor1[1]XC+coor1[2]YC-coor1[3]); 
 line(XC+coor1[2]YC-coor1[3]XC+coor1[4]YC-coor1[5]);
 line(XC+coor1[4]YC-coor1[5]XC+coor1[6]YC-coor1[7]);
 line(XC+coor1[6]YC-coor1[7]XC+coor1[8]YC-coor1[9]);
 line(XC+coor1[2]YC-coor1[3]XC+coor1[6]YC-coor1[7]);
 
  for(i=0;i<5;i++)
    {
    x=gxl4[2*i];
    y=gxl4[2*i+1];
    gxl4[2*i]=x*cos(3.14159*75/180.)
                     -  y*sin(3.14159*75/180.);    
     gxl4[2*i+1]=x*sin(3.14159*75/180.)
                           +y*cos(3.14159*75/180.) ;
    }
 line(XC+gxl4[0]YC-gxl4[1]XC+gxl4[2]YC-gxl4[3]); 
 line(XC+gxl4[2]YC-gxl4[3]XC+gxl4[4]YC-gxl4[5]);
 line(XC+gxl4[4]YC-gxl4[5]XC+gxl4[6]YC-gxl4[7]);
 line(XC+gxl4[6]YC-gxl4[7]XC+gxl4[8]YC-gxl4[9]);
 line(XC+gxl4[2]YC-gxl4[3]XC+gxl4[6]YC-gxl4[7]);

getch();
clearviewport();

 line(100YC500YC);
 line(XC100XC450);
 line(500300495295);
 line(500300495305);
 line(300100295105);
 line(300100305105);    
 line(XC+coor1[0]YC-coor1[1]XC+coor1[2]YC-coor1[3]); 
 line(XC+coor1[2]YC-coor1[3]XC+coor1[4]YC-coor1[5]);
 line(XC+coor1[4]YC-coor1[5]XC+coor1[6]YC-coor1[7]);
 line(XC+coor1[6]YC-coor1[7]XC+coor1[8]YC-coor1[9]);
 line(XC+coor1[2]YC-coor1[3]XC+coor1[6]YC-coor1[7]);
  
   for (i=0;i<5;i++)
      {
     gxl1[2*i]=2*gxl1[2*i] ;
     gxl1[2*i+1]=2*gxl1[2*i+1] ;
      }
 line(XC+gxl1[0]YC-gxl1[1]XC+gxl1[2]YC-gxl1[3]); 
 line(XC+gxl1[2]YC-gxl1[3]XC+gxl1[4]YC-gxl1[5]);
 line(XC+gx

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       4893  2009-05-17 17:15  txbh_1.c

----------- ---------  ---------- -----  ----

                 4893                    1


评论

共有 条评论