/*---------------------------------------------------------------------------*/ /* gccTUNNEL-gnuplot.c (円形水路トンネル断面設定) */ /*---------------------------------------------------------------------------*/ #include #include #include #include #define Nmax 500 #define pi M_PI double CAL_AREA(double B,double H,double theta); double CAL_LENG(double B,double H,double theta); double CAL_THETA(double D0,double Tc,double Tx,double W); double CAL_F(double ang,double W,double r,double Tx); void WGPL(char fnameW[50],char fnameF[50],int ksp,double D0,double Tc,double Tx,double W,double ts,double tp,double theta, double Ae,double Ac,double Ls); void AGR(FILE *fp,double D0,double Tc,double Tx,double W,double theta); void CAL_XY(double t1,double t2,double D0,double Tc,double Tx,double W,double theta,double *xx,double *yy); void CAL_XYARRAY(double t1,double t2,double dr1,double dr2,double x[Nmax],double y[Nmax],int *MG,int *MT, double D0,double Tc,double Tx,double W,double theta); void WGPLmodel(char fnameW[50],char fnameF[50],double D0,double Tc,double Tx,double W,double ts,double tp,double theta); /*---------------------------------------------------------------------------*/ int main(int argc,char *argv[]) { char fnameW[50]; char fnameF[50]; int ksp; double D0,Tc,Tx,W,ts,tp,theta; double B,H,Ae,Ac,Ls; strcpy(fnameW,argv[1]); /*コマンド記述ファイル名*/ strcpy(fnameF,argv[2]); /*出力画像ファイル名*/ ksp=atoi(argv[3]); /*鉄管の有無(-1:モデル図,0:鉄管無し,1:鉄管有り*/ D0=atof(argv[4]); /*水路内径*/ Tc=atof(argv[5]); /*覆工厚*/ Tx=atof(argv[6]); /*インバート部付加厚*/ W =atof(argv[7]); /*掘削インバート幅*/ ts=atof(argv[8]); /*吹付厚*/ tp=atof(argv[9]); /*設計線から支払線までの距離*/ theta=CAL_THETA(D0,Tc,Tx,W); /* 掘削面積 (Pay line)*/ B=D0+2.0*Tc+2.0*ts+2.0*tp; H=D0+2.0*Tc+Tx+ts+2.0*tp; Ae=CAL_AREA(B,H,theta); Ae=Ae*1e-6; /* 覆工面積 (Concrete)*/ B=D0+2.0*Tc; H=D0+2.0*Tc+Tx; Ac=CAL_AREA(B,H,theta)-0.25*pi*D0*D0; Ac=Ac*1e-6; /* 吹付長 (Shotcrete)*/ B=D0+2.0*Tc+2.0*ts; H=D0+2.0*Tc+Tx+ts; Ls=CAL_LENG(B,H,theta); Ls=Ls*1e-3; printf("Ae=%.1f Ac=%.1f Ls=%.1f\n",Ae,Ac,Ls); if(ksp<0){ WGPLmodel(fnameW,fnameF,D0,Tc,Tx,W,ts,tp,theta); }else{ WGPL(fnameW,fnameF,ksp,D0,Tc,Tx,W,ts,tp,theta,Ae,Ac,Ls); } return 0; } /*---------------------------------------------------------------------------*/ double CAL_AREA(double B,double H,double theta) { double rr,hh,ang,A0,A1,A2; ang=theta/180.0*pi; rr=0.5*B; hh=H-rr-rr*sin(ang); A0=(2.0*rr*cos(ang)-hh*tan(ang))*hh; /* 高さhhの台形の面積 */ A1=rr*rr*(ang+0.5*pi); /* 扇の面積 */ A2=rr*rr*sin(ang)*cos(ang); /* 三角形の面積 */ return A0+A1+A2; } /*---------------------------------------------------------------------------*/ double CAL_LENG(double B,double H,double theta) { double rr,hh,ang,L0,L1; ang=theta/180.0*pi; rr=0.5*B; hh=H-rr-rr*sin(ang); L0=rr*(pi+2.0*ang); /* 扇の周長 */ L1=hh/cos(ang) ; /* 片側直線部の長さ */ return L0+2.0*L1; } /*---------------------------------------------------------------------------*/ double CAL_THETA(double D0,double Tc,double Tx,double W) { /* 角度設定 (degree) */ double r,f,x1,x2,x3,f1,f2,f3; r=0.5*D0+Tc; x1=0.0; x2=90.0; x3=0.5*(x1+x2); do{ f1=CAL_F(x1,W,r,Tx); f2=CAL_F(x2,W,r,Tx); f3=CAL_F(x3,W,r,Tx); if(f1*f3<0){x2=x3;x3=0.5*(x1+x2);} if(f3*f2<0){x1=x3;x3=0.5*(x1+x2);} }while(fabs(x1-x2)>1e-6); return 0.5*(x1+x2); } /*---------------------------------------------------------------------------*/ double CAL_F(double ang,double W,double r,double Tx) { return W-(2.0*r*cos(ang/180.0*pi)-2.0*(r+Tx-r*sin(ang/180.0*pi))*tan(ang/180.0*pi)); } /*---------------------------------------------------------------------------*/ void WGPL(char fnameW[50],char fnameF[50],int ksp,double D0,double Tc,double Tx,double W,double ts,double tp,double theta, double Ae,double Ac,double Ls) { FILE *fp; double x1,y1,x2,y2,x3,y3,x4,y4,h; double BB,HU,HL,ds,dss,dl,dsh,phi; char str[50],sv[50]; BB=D0+2.0*Tc+2.0*ts+2.0*tp; HU=0.5*D0+Tc+ts+tp; HL=0.5*D0+Tc+Tx+tp; fp=fopen(fnameW,"w"); fprintf(fp,"reset\n"); fprintf(fp,"set terminal postscript eps enhanced font \"Helvetica\" 16\n"); fprintf(fp,"set output \"%s\"\n",fnameF); fprintf(fp,"#\n"); fprintf(fp,"set multiplot\n"); fprintf(fp,"#\n"); fprintf(fp,"set origin 0,0\n"); fprintf(fp,"set size ratio -1\n"); fprintf(fp,"#\n"); fprintf(fp,"set xrange [-8000:8000]\n"); fprintf(fp,"set yrange [-8000:8000]\n"); fprintf(fp,"set border 0\n"); fprintf(fp,"set xtics 0,0,0\n"); fprintf(fp,"set ytics 0,0,0\n"); fprintf(fp,"set xtics nomirror\n"); fprintf(fp,"set ytics nomirror\n"); fprintf(fp,"#\n"); fprintf(fp,"set style arrow 1 size graph 0.02,10 filled nohead linewidth 1 linetype 5\n");/*一点鎖線*/ fprintf(fp,"set style arrow 2 size graph 0.02,10 filled nohead linewidth 1 linetype 1\n");/*実線*/ fprintf(fp,"set style arrow 3 size graph 0.02,10 filled heads linewidth 1 linetype 1\n"); /*両矢印*/ fprintf(fp,"set style arrow 4 size graph 0.02,10 filled linewidth 1 linetype 1\n"); /*片矢印*/ fprintf(fp,"#\n"); /*一点鎖線*/ ds=1000.0; dss=200.0; dl=400.0; x1= 0.5*BB+ds+dss ; y1=0.0; x2=-(0.5*BB+0.5*ds); y2=0.0; x3=0.0 ; y3=-HL-0.5*ds; x4=0.0 ; y4= HU+0.5*ds; fprintf(fp,"set arrow as 1 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"set arrow as 1 from %.3f,%.3f to %.3f,%.3f\n",x3,y3,x4,y4); fprintf(fp,"#\n"); /*実線*/ x1=0.0 ;y1=0.5*D0+Tc; x2=0.5*BB+ds+ds+dss ;y2=y1; fprintf(fp,"set arrow as 2 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); x1=0.0 ;y1=0.5*D0; x2=0.5*BB+ds+dss ;y2=y1; fprintf(fp,"set arrow as 2 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); x1= (0.5*D0+Tc)*cos(theta/180.0*pi); y1=-(0.5*D0+Tc)*sin(theta/180.0*pi); x2=0.5*BB+ds+dss ;y2=y1; fprintf(fp,"set arrow as 2 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); x1=0.0 ;y1=-0.5*D0; x2=0.5*BB+ds+dss ;y2=y1; fprintf(fp,"set arrow as 2 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); x1=0.5*W ;y1=-(0.5*D0+Tc+Tx); x2=0.5*BB+ds+ds+dss ;y2=y1; fprintf(fp,"set arrow as 2 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); sprintf(sv,"%.3f",theta); strcpy(str,sv); strcat(str,"{/Symbol {\\260}}"); x1=0.0; y1=0.0; x2= (0.5*D0+Tc)*cos(theta/180.0*pi); y2=-(0.5*D0+Tc)*sin(theta/180.0*pi); x3= 0.5*(0.5*D0)*cos(theta/180.0*pi)-dl*sin(theta/180.0*pi); y3=-0.5*(0.5*D0)*sin(theta/180.0*pi)-dl*cos(theta/180.0*pi); fprintf(fp,"set arrow as 2 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"set label \"%s\" at %.3f,%.3f center rotat by %.3f\n",str,x3,y3,-theta); fprintf(fp,"#\n"); x1=-(0.5*D0+Tc) ;y1=0.0; x2=x1 ;y2=-HL-ds-ds-dss; fprintf(fp,"set arrow as 2 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); x1=-0.5*W ;y1=-HL+tp; x2=-0.5*W ;y2=-HL-ds-dss; fprintf(fp,"set arrow as 2 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); x1=0.5*W ;y1=-HL+tp; x2=0.5*W ;y2=-HL-ds-dss; fprintf(fp,"set arrow as 2 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); x1= (0.5*D0+Tc)*cos(theta/180.0*pi); y1=-(0.5*D0+Tc)*sin(theta/180.0*pi); x2=x1 ;y2=-HL-ds-dss; fprintf(fp,"set arrow as 2 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); x1=(0.5*D0+Tc) ;y1=0.0; x2=x1 ;y2=-HL-ds-ds-dss; fprintf(fp,"set arrow as 2 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"#\n"); /*両矢印*/ sprintf(sv,"%.0f",0.5*D0); strcpy(str,sv); x1=0.5*BB+ds ;y1=0.5*D0; x2=x1 ;y2=0.0; x3=x1-dl ;y3=0.5*(y1+y2); fprintf(fp,"set arrow as 3 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"set label \"%s\" at %.3f,%.3f center rotate by 90\n",str,x3,y3); sprintf(sv,"%.0f",(0.5*D0+Tc)*sin(theta/180.0*pi)); strcpy(str,sv); x1=0.5*BB+ds ;y1=0.0; x2=x1 ;y2=-(0.5*D0+Tc)*sin(theta/180.0*pi); x3=x1+dl ;y3=0.5*(y1+y2); fprintf(fp,"set arrow as 3 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"set label \"%s\" at %.3f,%.3f center rotate by 90\n",str,x3,y3); sprintf(sv,"%.0f",0.5*D0-(0.5*D0+Tc)*sin(theta/180.0*pi)); strcpy(str,sv); x1=0.5*BB+ds ;y1=-(0.5*D0+Tc)*sin(theta/180.0*pi); x2=x1 ;y2=-(0.5*D0); x3=x1-dl ;y3=0.5*(y1+y2); fprintf(fp,"set arrow as 3 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"set label \"%s\" at %.3f,%.3f center rotate by 90\n",str,x3,y3); fprintf(fp,"#\n"); sprintf(sv,"%.0f",D0+2.0*Tc+Tx); strcpy(str,sv); x1=0.5*BB+ds+ds ;y1=-HL; x2=x1 ;y2=HU-ts; x3=x1+dl ;y3=0.5*(y1+y2); fprintf(fp,"set arrow as 3 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"set label \"%s\" at %.3f,%.3f center rotate by 90\n",str,x3,y3); fprintf(fp,"#\n"); sprintf(sv,"%.0f",0.5*D0+Tc-0.5*W); strcpy(str,sv); x1=-(0.5*D0+Tc) ;y1=-HL-ds; x2=-0.5*W ;y2=y1; x3=0.5*(x1+x2) ;y3=y2-dl; fprintf(fp,"set arrow as 3 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"set label \"%s\" at %.3f,%.3f center\n",str,x3,y3); sprintf(sv,"%.0f",W); strcpy(str,sv); x1=-0.5*W ;y1=-HL-ds; x2= 0.5*W ;y2=y1; x3=0.0 ;y3=y2-dl; fprintf(fp,"set arrow as 3 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"set label \"%s\" at %.3f,%.3f center\n",str,x3,y3); sprintf(sv,"%.0f",(0.5*D0+Tc)*cos(theta/180.0*pi)-0.5*W); strcpy(str,sv); x1=(0.5*D0+Tc)*cos(theta/180.0*pi);y1=-HL-ds; x2=0.5*W ;y2=y1; x3=0.5*(x1+x2) ;y3=y2+dl; fprintf(fp,"set arrow as 3 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"set label \"%s\" at %.3f,%.3f center\n",str,x3,y3); fprintf(fp,"#\n"); sprintf(sv,"%.0f",D0+2.0*Tc); strcpy(str,sv); x1=-(0.5*D0+Tc); y1=-HL-ds-ds; x2=0.5*D0+Tc ; y2=y1; x3=0.5*(x1+x2) ; y3=y2-dl; fprintf(fp,"set arrow as 3 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"set label \"%s\" at %.3f,%.3f center\n",str,x3,y3); fprintf(fp,"#\n"); /*片矢印*/ dsh=0.8*ds; sprintf(sv,"%.0f",Tc); strcpy(str,sv); x1=0.5*BB+ds ;y1=0.5*D0+Tc+dsh; x2=x1 ;y2=0.5*D0+Tc; x3=x1+dl ;y3=0.5*(y2+0.5*D0); fprintf(fp,"set arrow as 4 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"set label \"%s\" at %.3f,%.3f center rotate by 90\n",str,x3,y3); sprintf(sv,"%.0f",Tc+Tx); strcpy(str,sv); x1=0.5*BB+ds ;y1=-(0.5*D0+Tc+Tx+dsh); x2=x1 ;y2=-(0.5*D0+Tc+Tx); x3=x1+dl ;y3=0.5*(y2-0.5*D0); fprintf(fp,"set arrow as 4 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"set label \"%s\" at %.3f,%.3f center rotate by 90\n",str,x3,y3); fprintf(fp,"#\n"); sprintf(sv,"%.0f",(0.5*D0+Tc)*(1.0-cos(theta/180.0*pi))); strcpy(str,sv); x1=0.5*D0+Tc+dsh; y1=-HL-ds; x2=0.5*D0+Tc ; y2=y1; x3=0.5*(x2+(0.5*D0+Tc)*cos(theta/180.0*pi));y3=y2-dl; fprintf(fp,"set arrow as 4 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"set label \"%s\" at %.3f,%.3f center\n",str,x3,y3); fprintf(fp,"#\n"); /*Shotcrete*/ phi=40.0; strcpy(str,"t="); sprintf(sv,"%.0f",ts); strcat(str,sv); h=0.5*D0+Tc+ts; x1=-(h+dsh)*cos(phi/180.0*pi); y1= (h+dsh)*sin(phi/180.0*pi); x2=-h*cos(phi/180.0*pi); y2= h*sin(phi/180.0*pi); x3=x1;y3=y1+0.5*dl; fprintf(fp,"set arrow as 4 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"set label \"%s\" at %.3f,%.3f center\n",str,x3,y3); strcpy(str,"Shotcrete"); y3=y3+1.2*dl; fprintf(fp,"set label \"%s\" at %.3f,%.3f center\n",str,x3,y3); fprintf(fp,"#\n"); if(ksp!=0){ /*Steel pipe (t0=50mm)*/ phi=75.0; strcpy(str,"Steel pipe"); h=0.5*D0+Tc+ts; x1=-(h+dsh)*cos(phi/180.0*pi); y1= (h+dsh)*sin(phi/180.0*pi); h=0.5*D0+50.0; x2=-h*cos(phi/180.0*pi); y2= h*sin(phi/180.0*pi); x3=x1;y3=y1+0.5*dl; fprintf(fp,"set arrow as 4 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"set label \"%s\" at %.3f,%.3f center\n",str,x3,y3); fprintf(fp,"#\n"); } /*水路内径*/ sprintf(sv,"%.0f",0.5*D0); strcpy(str,"r="); strcat(str,sv); x1=0.0; y1=0.0; x2=0.5*D0*cos(45.0/180.0*pi); y2=0.5*D0*sin(45.0/180.0*pi); x3=0.5*x2-dl*sin(45.0/180.0*pi); y3=0.5*y2+dl*cos(45.0/180.0*pi); fprintf(fp,"set arrow as 4 from %.3f,%.3f to %.3f,%.3f\n",x1,y1,x2,y2); fprintf(fp,"set label \"%s\" at %.3f,%.3f center rotate by 45\n",str,x3,y3); fprintf(fp,"#\n"); /*数量描画*/ x3=0.0; sprintf(sv,"%.1f",Ae); strcpy(str,"Ae="); strcat(str,sv); strcat(str," m^{/=10 2}"); y3=7500.0; fprintf(fp,"set label \"%s\" at %.3f,%.3f\n",str,x3,y3); sprintf(sv,"%.1f",Ac); strcpy(str,"Ac="); strcat(str,sv); strcat(str," m^{/=10 2}"); y3=6750.0; fprintf(fp,"set label \"%s\" at %.3f,%.3f\n",str,x3,y3); sprintf(sv,"%.1f",Ls); strcpy(str,"Ls="); strcat(str,sv); strcat(str," m"); y3=6000.0; fprintf(fp,"set label \"%s\" at %.3f,%.3f\n",str,x3,y3); fprintf(fp,"#\n"); fprintf(fp,"#\n"); /*骨材記号描画*/ AGR(fp,D0,Tc,Tx,W,theta); fprintf(fp,"#\n"); fprintf(fp,"#\n"); /*構造線描画*/ fprintf(fp,"plot \"-\" with lines linewidth 3 linetype 1 notitle,\\\n"); /*覆工外形線*/ fprintf(fp,"\"-\" with lines linewidth 3 linetype 1 notitle\n"); /*掘削外形線*/ /*覆工外形*/ x1= (0.5*D0+Tc)*cos(theta/180.0*pi); y1=-(0.5*D0+Tc)*sin(theta/180.0*pi); x2= 0.5*W; y2=-(0.5*D0+Tc+Tx); x3=-x2; y3=y2; x4=-x1; y4=y1; fprintf(fp,"%.3f %.3f\n",x1,y1); fprintf(fp,"%.3f %.3f\n",x2,y2); fprintf(fp,"%.3f %.3f\n",x3,y3); fprintf(fp,"%.3f %.3f\n",x4,y4); fprintf(fp,"e\n"); /*掘削外形*/ x1=(0.5*D0+Tc+ts)*cos(theta/180.0*pi); y1=-(0.5*D0+Tc+ts)*sin(theta/180.0*pi); x2=0.5*W+ts/cos(theta/180.0*pi); y2=-(0.5*D0+Tc+Tx); x3=-x2; y3=y2; x4=-x1; y4=y1; fprintf(fp,"%.3f %.3f\n",x1,y1); fprintf(fp,"%.3f %.3f\n",x2,y2); fprintf(fp,"%.3f %.3f\n",x3,y3); fprintf(fp,"%.3f %.3f\n",x4,y4); fprintf(fp,"e\n"); fprintf(fp,"#\n"); /*円形部描画*/ fprintf(fp,"set origin 0,0\n"); fprintf(fp,"set polar\n"); fprintf(fp,"set angles degree\n"); fprintf(fp,"set samples 720\n"); fprintf(fp,"set trange [0:360]\n"); if(ksp==0){ fprintf(fp,"plot %.3f with lines linewidth 3 linetype 1 notitle\n",0.5*D0); /*水路内径*/ }else{ fprintf(fp,"plot %.3f with lines linewidth 3 linetype 1 notitle,\\\n",0.5*D0); /*鉄管内径*/ fprintf(fp,"%.3f with lines linewidth 3 linetype 1 notitle\n",0.5*D0+50.0); /*鉄管外径(t0=50mm)*/ } fprintf(fp,"#\n"); fprintf(fp,"set origin 0,0\n"); fprintf(fp,"set trange [%.3f:%.3f]\n",-theta,180.0+theta); fprintf(fp,"plot %.3f with lines linewidth 3 linetype 1 notitle,\\\n",0.5*D0+Tc); /*覆工外径*/ fprintf(fp,"%.3f with lines linewidth 2 linetype 1 notitle\n",0.5*D0+Tc+ts); /*掘削径*/ fprintf(fp,"#\n"); fprintf(fp,"#\n"); fprintf(fp,"unset multiplot\n"); fprintf(fp,"#\n"); fclose(fp); } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ void AGR(FILE *fp,double D0,double Tc,double Tx,double W,double theta) { /*骨材マークの描画*/ int i,MG,MT; double x[Nmax],y[Nmax]; double dr1=600.0,dr2=300.0; double t1=0.0,t2=360.0; CAL_XYARRAY(t1,t2,dr1,dr2,x,y,&MG,&MT,D0,Tc,Tx,W,theta); for(i=0;i<=MG;i++){ fprintf(fp,"set label \"%s\" at %.3f,%.3f center font \"arial,%d\"\n","o",x[i],y[i],10); } for(i=MG+1;i<=MT;i++){ fprintf(fp,"set label \"%s\" at %.3f,%.3f center font \"arial,%d\"\n","o",x[i],y[i],3); } } /*---------------------------------------------------------------------------*/ void CAL_XY(double t1,double t2,double D0,double Tc,double Tx,double W,double theta,double *xx,double *yy) { /****************************/ /* 乱数での座標設定 */ /****************************/ double rr,tt,r1,r2; double phi1,phi2; double x1,y1,x2,y2,a1,b1,a2,b2,a3,b3; x1=0.5*W; y1=(0.5*D0+Tc+Tx); phi1=270.0-atan(x1/y1)/pi*180.0; x1=-(0.5*D0+Tc)*cos(theta/180.0*pi); y1=-(0.5*D0+Tc)*sin(theta/180.0*pi); x2=-0.5*W; y2=-(0.5*D0+Tc+Tx); a1=(y2-y1)/(x2-x1); b1=(x2*y1-x1*y2)/(x2-x1); a2=0.0; b2=-(0.5*D0+Tc+Tx); x1=0.5*W; y1=(0.5*D0+Tc+Tx); phi2=270.0+atan(x1/y1)/pi*180.0; x1= (0.5*D0+Tc)*cos(theta/180.0*pi); y1=-(0.5*D0+Tc)*sin(theta/180.0*pi); x2= 0.5*W; y2=-(0.5*D0+Tc+Tx); a3=(y2-y1)/(x2-x1); b3=(x2*y1-x1*y2)/(x2-x1); tt=t1+(double)rand()/(double)RAND_MAX*(t2-t1); r1=0.5*D0+100.0; if(0.0<=tt&&tt<=180.0+theta) r2=0.5*D0+Tc; if(180.0+theta