#include <stdio.h>
#include <graphics.h>
#include <conio.h>
#include <math.h>
#define PI M_PI
#define MAX_theta 80
#define ORIGIN_color WHITE
void graph_deltaMAX(void);
void graph_conf(void);
void graph_legend(void);
void mark1(int, int, int);
int MAXDELTA[MAX_theta][2], MY1[MAX_theta][2];
int j=0, center_x, center_y, zoomx=7, zoomy=2;
void main(void)
{
int gdrive = DETECT,gmode;
float step;
double theta, delta=OL, k=1.4;
double a, b, c, M, MaxDelta, My1;
initgraph (&gdrive,&gmode,"");
graph_conf();
step = 4./MAX_theta;
for(M=.1:M<=4; M+=step) {
MaxDelta = delta;
for(theta=.1; theta<=90.; theta=theta+.1) {
a = M*M * sin(theta*PI/180.) * sin(theta*PI/180.)-1;
b = M*M * (k+cos(2.*theta*PI/180.))+2;
c = a/b;
delta = atan((2.*c)/(tan(theta*PI/180.)))*180./PI;
if (MaxDelta <= delta ) {
MaxDelta = delta;
MAXDELTA[(M*MAX_theta/4-1)][0] = center_x + zoomx * delta;
MAXDELTA[(M*MAX_theta/4-1)][1] = center_y - zoomx * theta;
}
if(delta<0) delta = -100.;
putpixel(center_x+zoomx*delta, center_y-zoomy*theta, BLUE);
}
{
int tmpi;
for (tmpi=0; tmpi<MAX_theta; tmpi++)
mark1(MAXDELTA[tmpi][0], MAXDELTA[tmpi][1], LIGHTRED);
}
}
graph_deltaMax();
graph_legend();
getch();
closegraph();
}
void mark1(int x, int y, int color)
{
putpixel( x+1, y, color);
putpixel( x-1, y, color);
putpixel( x, y+1, color);
putpixel( x, y-1, color);
}
void graph_conf()
{
center_x=100;
center_y=getmaxy()/2+100;
line(100,center_y,getmaxx()-100,center_y);
line(1000,center_y,100,100);
setbkcolor(BLACK);
}
void graph_legend()
{
outtextxy(90,center_y+10,"0.0");
outtextxy(getmaxx()-100,center_y-3,">X");
outtextxy(81,96,"y ^");
outtextxy(200,110,"Name: Ji-Hyung Kim");
outtextxy(200,120,"Student #: 2001313955");
outtextxy(180,350,"Deflection angle,delta,degrees");
outtextxy(DEFAULT_FONT,VERT_DIR,1);
outtextxy(80,110,"Shock Wave Angle,theta,degrees");
}
void graph_deltaMax()
{
int tmpi;
long tmpj;
setcolor(LIGHTGREEN);
for (tmpi=2; tmpi<MAX_theta-2; tmpi++){
for (tmpj=1L; tmpj<100000; tmpj++);
line(MAXDELTA[tmpi][0],MAXDELTA[tmpi][1],
MAXDELTA[tmpi+1][0], MAXDELTA[tmpi+1][1];
}
setcolor(ORIGIN_color);
}
이게 컴파일까지만 되고 그 이후론 linker error가 나네요...
graph_deltaMax() 이거 한가지만 define하지 못한다고 자꾸 나와요 해결부탁해요..ㅡㅜ
|