/* plane2gl.c Rotating *.dat with lighting */ /* Utah Graphics ASCII data *.dat of *.det */ #include #include #include #include #include "plane_fuse.h" /* compute some day */ static GLfloat size = 8.5; /* auto scale */ static GLfloat roll = 0.0; /* rotate about Y axis 'r' */ static GLfloat pitch = 0.0; /* rotate about Z axis 'p' */ static GLfloat heading = 0.0; /* rotate about Y axis 'h' */ static GLfloat pos[3] = {0.0, 0.0, 0.0}; static int background = 1; /* background color 'b' */ static int wire = 0; /* draw wireframe 'w' */ static int vert = 0; /* draw vertices 'v' */ static int colorz = 0; /* color based on z 'c' */ static GLfloat zavg = 0.0; static GLfloat zmin = 0.0; static GLfloat zmax = 0.0; static double xw[30][17]; /* wing raw mesh */ static double yw[30][17]; static double zw[30][17]; static double xws[30][17]; /* wing scaled and offset mesh */ static double yws[30][17]; static double zws[30][17]; static GLfloat amb[4] = { 0.329412, 0.223529, 0.027451, 1.0}; /* brass */ static GLfloat dif[4] = { 0.780392, 0.568627, 0.113725, 1.0}; /* material */ static GLfloat spe[4] = { 0.992157, 0.941176, 0.807843, 1.0}; static GLfloat shiney = 0.21794872; /* light source */ static GLfloat ambient[] = {0.0, 0.0, 0.0, 1.0}; /* no ambient */ static GLfloat diffuse[] = {0.4, 0.4, 0.4, 1.0}; /* mid diffuse */ static GLfloat specular[] = {0.4, 0.4, 0.4, 1.0}; /* mid specular */ static GLfloat position[] = {0.0, 0.0, 3.0, 0.0}; static GLdouble m[16]; /* 4 by 4 transformation matrix */ static int win_w, win_h; static double f(double x) /* 0015 wing */ { return (15./20.)*(0.29690*sqrt(x)-0.12600*x-0.35160*x*x+ 0.28430*x*x*x-0.10150*x*x*x*x); } void wing_2d(double xw[30][17], double yw[30][17], double zw[30][17]) { /* function [zw, xw, yw] = naca0015 */ int ni = 30; int nj = 17; double *x; double *y; double xmin=0.0; double xmax=1.0; double dx, dz, x1, y1; int i, j; x=(double *)malloc(ni*sizeof(double)); y=(double *)malloc(ni*sizeof(double)); dx = (xmax-xmin)/(double)((ni/2)-1); for(i=0; i