Program New_SoSkrugl; uses newzapoln in 'newzapoln.pas'; const n=31; type mass_N = array[1..31*31] of real; mass_NM = array[1..31*31,1..63] of real; mass_NN = array[1..31*31,1..31*31] of real; flag_arr = array [1..4] of boolean; var F1, F2: text; i,j,k: integer; vect_u: array [1..n*n] of real; new_u: array [1..n*n] of real; x_set, y_set: array [1..n,1..n] of real; x_skr_h, y_skr_h, x_skr_v, y_skr_v: array [1..2*(n_rad-1)] of real; x_bor, y_bor:array [1..n-v-n_rad-1,1..2] of real; temp, deltax, deltay: real; check: flag_arr; isnear: boolean; procedure Get_Coord; var i,j:integer; center:real; begin center:=p/2; for i:=1 to n do for j:=1 to n do begin x_set[i,j]:=(j-1)*h; y_set[i,j]:=(i-1)*h; end; for i:=1 to n_rad-1 do begin x_skr_v[i]:=center - uu/2 - rad + i*h; y_skr_h[i]:=vv+i*h; y_skr_v[i]:=vv+rad-h*sqrt(n_rad*n_rad-i*i); x_skr_h[i]:=center - uu/2 - rad + h*sqrt(n_rad*n_rad-(n_rad-i)*(n_rad-i)); end; for i:=1 to n_rad-1 do begin x_skr_v[2*(n_rad-1)-i+1]:=center + uu/2 + rad - i*h; y_skr_h[2*(n_rad-1)-i+1]:=vv+i*h; y_skr_v[2*(n_rad-1)-i+1]:=vv+rad-h*sqrt(n_rad*n_rad-i*i); x_skr_h[2*(n_rad-1)-i+1]:=center + uu/2 + rad - h*sqrt(n_rad*n_rad-(n_rad-i)*(n_rad-i)); end; for i:=0 to n-v-n_rad-2 do begin if i<=z then begin x_bor[i+1,1]:=((dx/z)*i-u/2)*h+center; x_bor[i+1,2]:=((dx/z)*i+u/2)*h+center; end else begin x_bor[i+1,1]:=(((-dx2)/(n-v-n_rad-z-1))*(i-z+1)-u/2)*h+center+dxx; x_bor[i+1,2]:=(((-dx2)/(n-v-n_rad-z-1))*(i-z+1)+u/2)*h+center+dxx; end; end; end; procedure Is_Near (i:integer; var detect:flag_arr; var delta_x, delta_y: real; var isnearr: boolean); var i_loc, j_loc: integer; begin j_loc:=(i div n) + 1; i_loc:=i mod n; deltax:=0; deltay:=0; for j:=1 to 4 do detect[j]:=False; isnearr:=False; for j:=1 to n_rad-1 do begin ////////////////////////////////////////////////////////// if i_loc < (n div 2) then begin if ((abs(x_skr_h[j]-x_set[j_loc, i_loc])0) and (abs(y_skr_h[j])=y_set[j_loc, i_loc])) then begin delta_x:=x_skr_h[j]-x_set[j_loc, i_loc]; if delta_x<0 then begin detect[1]:=True; isnearr:=True; end; if delta_x>0 then begin detect[3]:=True; isnearr:=True; end; end; if ( (abs(y_skr_v[j]-y_set[j_loc, i_loc])0) and ((x_skr_v[j]=x_set[j_loc, i_loc]) or (x_set[j_loc, i_loc]=n-x_skr_v[j]-1))) then begin delta_y:=y_skr_v[j]-y_set[j_loc, i_loc]; if delta_y<0 then begin detect[4]:=True; isnearr:=True; end; if delta_y>0 then begin detect[2]:=True; isnearr:=True; end; end; end else begin if ((abs(x_skr_h[2*(n_rad-1)-j+1]-x_set[j_loc, i_loc])0) and (abs(y_skr_h[j])=y_set[j_loc, i_loc])) then begin delta_x:=x_skr_h[2*(n_rad-1)-j+1]-x_set[j_loc, i_loc]; if delta_x<0 then begin detect[1]:=True; isnearr:=True; end; if delta_x>0 then begin detect[3]:=True; isnearr:=True; end; end; if ( (abs(y_skr_v[j]-y_set[j_loc, i_loc])0) and ((x_skr_v[j]=x_set[j_loc, i_loc]) or (x_set[j_loc, i_loc]=n-x_skr_v[j]-1))) then begin delta_y:=y_skr_v[j]-y_set[j_loc, i_loc]; if delta_y<0 then begin detect[4]:=True; isnearr:=True; end; if delta_y>0 then begin detect[2]:=True; isnearr:=True; end; end; end; end; end; procedure Is_Near2 (i:integer; var detect:flag_arr; var delta_x, delta_y: real; var flag: boolean); var i_loc, j_loc: integer; center, klmn: real; label lab; begin j_loc:=(i div n) - n_rad - v + 1; i_loc:=i mod n; deltax:=0; deltay:=0; if j_loc<0 then goto lab; for j:=1 to 4 do detect[j]:=False; flag:=False; center:=p/2; klmn:=abs(x_bor[j_loc,j]-x_set[j_loc+n_rad, i_loc]); for j:=1 to 2 do begin if (klmn0) then begin delta_x:=x_bor[j_loc,j]-x_set[j_loc+n_rad, i_loc]; detect[j]:=True; flag:=true; end; end; lab: end; procedure SoSkrugl; var ka,ka1,j,i,tt: longint; x,i1,i2,i3,i4,i5,g,j1,j2,j3,j4,j5: integer; k,zu,y,t1,t2,t3,t4: real; F1,F2,F3,F4: text; enter,enter1: boolean; begin Get_Coord; { if ((n w/2)) then begin halt; end //end if else begin} Assign(F1, 'DATA\matr_d_u.txt'); Rewrite(F1); k:=0; // end; for i:=1 to n*n do begin enter:=False; Case i of 2..(n-1): begin InsUpBottom(n,i,h,F1); enter:=true end; (n-1)*n+2..(n*n-1): begin InsDownBottom(n,i,h,F1); enter:=true end; v*n+2..v*n+1+(n div 2)-round(u/2)-n_rad, (v+1)*n-(n div 2)+round(u/2)+n_rad .. (v+1)*n-1: begin InsTissueUBPoint(n,i,r1,r2,h,F1); enter:=true end; v*n+1+(n div 2)-round(u/2)-n_rad+1..(v+1)*n-(n div 2)+round(u/2)+n_rad-1: begin Is_Near(i, check, deltax, deltay, isnear); if isnear then begin InsAkupSkrugPoint (n,i,deltay,r1,r3,h,F1); enter:=true; end else begin InsAkupUBPoint(n,i,r1,r3,h,F1); enter:=true end; end; //(v+w)*n+2 .. (v+w)*n+1+(n div 2)-round(u/2), (v+w+1)*n-(n div 2)+round(u/2) .. (v+w+1)*n-1: // begin InsTissueDBPoint(n,i,r2,r4,h,F1); enter:=true end; // (v+w)*n+1+(n div 2)-round(u/2)+1 .. (v+w+1)*n-(n div 2)+round(u/2)-1: // begin InsAkupDBPoint(n,i,r3,r4,h,F1); enter:=true end; end; If (i=1) or ((i<>1) and ((i-1) mod n=0)) then begin InsLeftBottom(n,i,h,F1); enter:=true end; If (i mod n=0) then begin InsRightBottom(n,i,h,F1); enter:=true end; { if w>=4 then for g:=3 to w-1 do begin If (i=(v+g)*n+1+(n div 2)-(u/2)) then begin InsTissueAkupPoint(n,i,r2,r3,h,F1); enter:=true end; If (i=(v+g+1)*n-(n div 2)+(u/2)) then begin InsAkupTissuePoint(n,i,r2,r3,h,F1); enter:=true end; end;} if not enter then begin Is_Near(i, check, deltax, deltay, isnear); if isnear then begin /////////////////173!!!!!! InsSpecMidPoint (n,i,deltax,deltay,r2,r3,h,F1); enter:=true; end; end; if not enter then begin Is_Near2(i, check, deltax, deltay, isnear); if isnear then InsSpecMidPoint2(n,i,deltax,r2,r3,h,F1) else InsMiddlePoint(i,h,F1); end; end; close(F1); end; // main begin SoSkrugl; end.