#include "graph.h"
#include "math.h"
#include "stdio.h"
double pi=3.14159;
double n=36.0;
static double xx[]={150.0,200.0,210.0,60.0,150.0};
static double zz[]={0.0,0.0,0.0,0.0,0.0};
static double xy[]={-55.0,-20.0,50.0,40.0,-55.0};
static double f[4][4];
int i;
double th;
double x,y,z;
double x0,y0,z0;
void affine(void);
void affine3(double *x,double *y,double *z);
void rotate_y(double theta_y);
void axis(void);
void main(void)
{
int graphdriver=DETECT,graphmode;
initgraph(&graphdriver,&graphmode,"");
cleardevice();
setactivepage(0);
setvisualpage(0);
setbkcolor(1);
axis();
th=pi/n;
rotate_y(th);
affine();
getch();
closegraph();
}
void axis(void)
{
line(320,240,600,240);
line(320,240,320,100);
}
void rotate_y(double theta_y)
{
double co=cos(theta_y),si=sin(theta_y);
f[0][0]=co;f[0][1]=si;
f[0][3]=0.0;
f[1][0]=0.0;f[1][1]=1.0;
f[1][2]=0.0;f[1][3]=0.0;
f[2][0]=-si;f[2][1]=0.0;
f[2][2]=co;f[2][3]=0.0;
f[3][0]=0.0;f[3][1]=0.0;
f[3][2]=0.0;f[3][3]=1.0;
}
void affine3(double *x,*y,*z)
{
double _x,_y,_z;
_x=*x;_y=*y;_z=*z;
*x=_x*f[0][0]+_y*f[1][0]+_z*f[2][0]+f[3][0];
*y=_x*f[0][1]+_y*f[1][1]+_z*f[2][1]+f[3][1];
*z=_x*f[0][2]+_y*f[1][2]+_z*f[2][2]+f[3][2];
}
void affine(void)
{
for(th=0.0;th<2*pi;th+=pi/n){
for(i=0;i<4;i++){
x=xx[i];y=yy[i];z=zz[i];
affine3(&x,&y,&z);
if(i==0)
putpixel(320+(int)x,240-(int)y,1);
else{
setcolor(5);
line(320+(int)x0,240-(int)y0,320+(int)x,240-(int)y);
}
xx[i]=x0=x;yy[i]=y0=y;zz[i]=z0=z;
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
lzw算法最新版下载.rar (45个子文件)
15040311351
LZWTABLE.H 2KB
hglz.mak 13KB
hglz.ncb 145KB
STDAFX.H 299B
TLZWDOC.H 926B
Lzwcode.cpp 9KB
hglz.opt 50KB
TLZW.WSP 170B
Tlzw.rc 9KB
TRY.C 2KB
Tlzw.clw 3KB
TLZW.VCW 391B
LZWFILE.CPP 16KB
TLZW.H 805B
LZWCODE.H 3KB
TLZW.CPP 3KB
RESOURCE.H 1KB
TLZWVIEW.CPP 2KB
MAINFRM.H 679B
hglz.mdp 36KB
TLZWVIEW.H 1KB
res
ICON1.ICO 766B
TLZW.ICO 766B
DECODE.ICO 766B
TLZW.RC2 1KB
ENLZW.CPP 6KB
Tlzw.def 218B
Tlzw.aps 42KB
LZWFILE.H 3KB
Release
Singledl.cpp 3KB
MAINFRM.CPP 1KB
TLZW.RES 13KB
Decodedl.cpp 2KB
BATCHDLG.CPP 5KB
DECODEDL.H 691B
hglz.plg 2KB
hglz.dsw 531B
hglz.bak 13KB
hglz.dsp 5KB
下载说明.htm 5KB
STDAFX.CPP 204B
BATCHDLG.H 1KB
SINGLEDL.H 764B
TLZWDOC.CPP 2KB
LZWTABLE.CPP 4KB
共 45 条
- 1
资源评论
- nuc5022015-04-07很需要,感谢
yutingshu
- 粉丝: 5
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功