www.pudn.com > wave.zip > Wave3.cpp
#include#include #include #include #include #include #define PI 3.1415926535 #define L 50 #define E 5 #define ELS 1 #define MAS 10 #define FR 1.01 typedef unsigned char byte; char far*VGA=(char far*)0xA0000000L; float CX=320/(PI*70/180),CY=200/(PI*70/180);int MED=1;//L*(L+1)/2; float gx=0,gy=0; void putpixel(int x,int y,int c){VGA[x+320*y]=c;} struct punto{float v,p;}; punto*m=(punto*)malloc(L*L*sizeof(punto)); void draw(int n,int c){ float x=E*(L/2-n%L+.5), y=E*(L/2-n/L-.5), z=m[n].v; float k,r; k=arg(complex(x,y));r=hypot(x,y);x=r*cos(k+gx);y=r*sin(k+gx); k=arg(complex(y,z));r=hypot(y,z);y=r*cos(k+gy);z=r*sin(k+gy); z+=300;if(z>0)putpixel(160+atan(x/z)*CX,100-atan(y/z)*CY,z*c); } main() { REGS vga;vga.h.ah=0x00;vga.h.al=0x13;int86(0x10,&vga,&vga); REGS mouse; int n,k; for(n=0;n L)m[n].p+=(m[n-L].v-m[n].v)/ELS;} if(kbhit()) { k=getch(); if(!k) { k=getch(); for(n=0;n