/*################################################*/
/* ----- dg.c October , 2002, Wuhan ----- */
/* Window Version */
/*################################################*/
#include <windows.h>
#include <time.h>
#include <conio.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
/**************************************************/
FILE *fl0, *fl1, *fl2, *fl3;
/*------------------------------------------------*/
LRESULT CALLBACK WindowFunc(HWND, UINT, WPARAM, LPARAM);
/*------------------------------------------------*/
/* name of window class */
char szWinName[] = "MyWin";
char ch;
/*------------------------------------------------*/
/* holds output strings long x long y */
char str[255];
POINT vert[200];
/*------------------------------------------------*/
/* screen dimensions */
int maxX;
int maxY;
/*------------------------------------------------*/
HWND hwnd; /* Storage For Window Handle */
/*------------------------------------------------*/
/* handle of memory DC */
HDC memdc;
/*------------------------------------------------*/
/* handle of compatible bitmap */
HBITMAP hbit;
/*------------------------------------------------*/
/* handle of brushes */
HBRUSH hnewbrush;
HBRUSH hOldbrush;
HBRUSH hbrush[11];
/*------------------------------------------------*/
/* create pens handle of old pen */
HPEN hOldpen;
HPEN hpen[6];
/*------------------------------------------------*/
/* store the font handles */
HFONT holdf;
HFONT hnewf1;
HFONT hnewf2;
/*------------------------------------------------*/
HDC hdc;
PAINTSTRUCT paintstruct;
/**************************************************/
long **k0; /* k0[n0+1][2] */
long *m;
/*------------------------------------------------*/
long i, i0, i1, i2, i3, i4, i7, i8, i9;
long j, j00, j01, j2;
long l, l0, l1;
long kk, k1;
long n0, n1, n2, n3, n4, n5, n6, n7, n8;
long o;
long p0, pe;
/*------------------------------------------------*/
long ix, iy, ic, iw;
/*------------------------------------------------*/
double **d; /* d[50001][3] */
double **g; /* g[10001][6] */
double *x; /* x[401] */
double *y; /* y[401] */
double **s; /* s[401][4] */
/*------------------------------------------------*/
double q0[501][3], e[7][7];
double q[3][3], p[3], w[12];
/*------------------------------------------------*/
double a0, a1, a9;
double b0, b1, b2;
double c0, c1;
double d0, d1, dd;
double e0, e1, e2;
double r0, r1;
double s0, s1, s2;
double t0;
double v1;
double wr;
double w0, w1, w2, w3, w4, w5, w6, w7, w8;
double x0, x1, x2, x3, x7, x8, x9, x10;
double y00, y01, y2, y3, y7, y8, y9, y10;
char aa[255], *cc, e$[80];
/**************************************************/
/* dg00: enter data */
/**************************************************/
void dg00()
{
/*------------------------------------------------*/
dd = 3.1415926535/180;
ic = 1;
iw = 1;
/*------------------------------------------------*/
fl0 = fopen ("ff.c","r");
fscanf(fl0,"%s ",aa);
fclose(fl0);
/*------------------------------------------------*/
/* save undeformed shape */
fl0= fopen ("data","w");
fprintf(fl0,"maxX=%d maxy=%d \n", maxX, maxY);
fl1= fopen (aa,"r");
/*------------------------------------------------*/
/* fprintf(fl0,"enter displacement monitor limit \n ?"); */
/* scanf("%lf", &c0); */
/*------------------------------------------------*/
fscanf (fl1,"%d %d %d %d %d",&n0,&n1,&n4,&o, &n5);
fscanf (fl1,"%lf %lf %lf %lf ", &w1, &w2, &w3, &w4);
fprintf(fl0,"w1=%lf %lf %lf %lf \n", w1, w2, w3, w4);
/*------------------------------------------------*/
n7=n5+4;
m =(long *)malloc(sizeof(long )*n7);
/*------------------------------------------------*/
n7=n0+1;
n8=4;
k0=(long **)malloc(sizeof(long *)*n7);
for(i=0; i<n7; ++i) k0[i]=(long *)malloc(sizeof(long)*n8);
x =(double *)malloc(sizeof(double)*n7);
y =(double *)malloc(sizeof(double)*n7);
/*------------------------------------------------*/
n7=n0+1;
n8=10;
s =(double **)malloc(sizeof(double *)*n7);
for(i=0; i<n7; ++i) s[i]=(double *)malloc(sizeof(double)*n8);
/*------------------------------------------------*/
n7=o*(n5+2)+1;
n8=3;
d =(double **)malloc(sizeof(double *)*n7);
for(i=0; i<n7; ++i) d[i]=(double *)malloc(sizeof(double)*n8);
/*------------------------------------------------*/
n7=n1*(n5+2)+1;
n8=6;
g =(double **)malloc(sizeof(double *)*n7);
for(i=0; i<n7; ++i) g[i]=(double *)malloc(sizeof(double)*n8);
/*------------------------------------------------*/
for (i=1; i<= n0; i++)
{
fscanf(fl1,"%d %d",&k0[i][1],&k0[i][2]);
} /* i */
/*------------------------------------------------*/
for (i=1; i<= n5+2; i++)
{
for (j=1; j<= o; j++)
{
fscanf(fl1,"%lf %lf",&d[(i-1)*o+j][1],&d[(i-1)*o+j][2]);
} /* j */
for (j=1; j<= n1; j++)
{
j01=(i-1)*n1+j;
fscanf(fl1,"%lf %lf %lf %lf %lf",
&g[j01][1],&g[j01][2],&g[j01][3],&g[j01][4],&g[j01][5]);
} /* j */
if (i > 1) fscanf(fl1,"%lf %lf %lf", &q0[i][0], &q0[i][1], &q0[i][2]);
} /* i */
/*------------------------------------------------*/
for (i=1; i<= n0; i++)
{
fscanf(fl1,"%lf %lf %lf",&s[i][1],&s[i][2],&s[i][3]);
} /* i */
fclose(fl1);
/**************************************************/
q0[1][1] = 0;
for (i=1; i<= n1; i++)
{
fprintf(fl0,"================= i=%d \n", i);
for (j=1; j<= n5+1; j++)
{
fprintf(fl0,"%+lf ",q0[j][1]);
i1 = (j - 1)*n1 + i;
x3 = g[i1][4];
y3 = g[i1][5];
a0 = sqrt(x3*x3 + y3*y3);
fprintf(fl0,"%+lf \n", a0);
} /* j */
} /* i */
/**************************************************/
/* compute window limits */
w1 = d[1][1];
w2 = d[1][1];
w3 = d[1][2];
w4 = d[1][2];
for (i=1; i<= n0; i++)
{
i1 = k0[i][1];
i2 = k0[i][2];
for (j=i1; j<= i2; j++)
{
if (w1 > d[j][1]) w1 = d[j][1];
if (w2 < d[j][1]) w2 = d[j][1];
if (w3 > d[j][2]) w3 = d[j][2];
if (w4 < d[j][2]) w4 = d[j][2];
} /* j */
} /* i */
/*------------------------------------------------*/
/* v1 : 1.0--1.3 ratio of window */
/* form window for screen and ps */
wr = (double)maxX/(double)maxY;
w5 =
评论1