#include "glos.h" #include #include #include "windows.h" #include "math.h" #include "stdio.h" #include #include #include //#include "../require.h"void myinit(void); using namespace std; #define SZ 500 // Buffer size void CALLBACK display(void); void CALLBACK reshape(GLsizei w,GLsizei h); void CALLBACK left(void);//按 LEFT void CALLBACK right(void);//按 RIGHT void CALLBACK up(void);//按 UP void CALLBACK down(void);//按 DOWN void CALLBACK big(void);//按 b void CALLBACK small1(void);//按 s ////////////////////////////////////// #define MAXFILE 6000 #define MINFILE 0 #define STEPFILE 25 #define XFACTOR .05 #define YFACTOR .05 #define ZFACTOR .05 #define CRYSTCONST 5.65315*XFACTOR ////////////////////////////////////// static int z_motion=0,rotate=0,yinzi=1; int maxfile,minfile,stepfile,totalpoint=200; float enlargerate; /* GLfloat points[4][4][3]={ {{-1.5,-1.5,2.0},{-0.5,-1.5,2.0}, {0.5,-1.5,-1.0},{1.5,-1.5,2.0}}, {{-1.5,-0.5,1.0},{-0.5,1.5,2.0}, {0.5,0.5,1.0},{1.5,-0.5,-1.0}}, {{-1.5,0.5,2.0},{-0.5,0.5,1.0}, {0.5,0.5,3.0},{1.5,-1.5,1.5}}, {{-1.5,1.5,-2.0},{-0.5,1.5,-2.0}, {0.5,0.5,1.0},{1.5,1.5,-1.0}}}; */ int datanew=0; ///////////////////////////// // MATRIX SIZE! // SHOULD BE MODIFIED GLfloat temp[3200][5]; ///////////////////////////// GLfloat color[4][3]={ {1.0,0.0,0.0},{0.0,1.0,0.0},{0.0,0.0,1.0},{1.0,1.0,1.0}}; //convert! void convert(int ii,char* filename) { int j,k,i; i=ii; filename[0]='P'; filename[1]='O'; filename[2]='S'; filename[8]='.'; filename[9]='D'; filename[10]='A'; filename[11]='T'; filename[12]='\0'; filename += 7 ; for(j=0;j<5;j++) { k=fmod(i,10); i=(i-k)/10; *filename = k+'0'-0; filename--; } return; } void getdata(int snoffile) { float x,y,z,sn,label; float *p; char buf[SZ],filename[13]; convert(snoffile,filename); fstream in(filename); p=(float *)temp; while(in.getline(buf, SZ)) { // Removes \n istrstream s(buf); s>>sn>>label>>x>>y>>z; *p=(float)sn;p++; *p=label; p++; *p=(x-0)*XFACTOR;p++; *p=(y-0)*YFACTOR;p++; *p=(z-0)*ZFACTOR;p++; //noofdata++; } cout<<"file " <>sn>>label>>x>>y>>z; *p=(float)sn;p++; *p=label; p++; *p=(x-0)*.03;p++; *p=(y-0)*.03;p++; *p=(z-0)*.03;p++; } */ //printf(" %f %f %f\n",filename,temp[2][0],temp[2][1],temp[2][2]); //cout<