unit USA0010FRM;interfaceuses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Menus;type
  TSA0010 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    procedure CacuSinCos;
    { Public declarations }
  end;type
  tagPointMes=record
      x,y,r:shortint;
      typ_e :integer;
   end;
   tagRadialLineMes=record
      n120,n240,n480:integer;
      pPMes:^tagPointMes;
   end;
const numcount = 360;
const pi = 3.1415927;
var
  SA0010 : TSA0010;
  LineMes: array[0..numcount] of tagRadialLineMes;
  pAllPointMes,pCur :^tagPointMes;implementation
uses math;{$R *.DFM}procedure TSA0010.CacuSinCos;
var
  seta,i,xx,yy,idx,j,LinePointNum,jj:integer;
  x,y,r,TotalPointNum:Integer;
  p120 : Array [0..300*numcount] of tagPointMes;//
  p240 : Array [0..800*numcount] of tagPointMes;
  p480 : Array [0..4000*numcount] of tagPointMes;
begin
  TotalPointNum:=0;
  for i:=0 to numcount do begin
    LineMes[i].n120:=0;
    LineMes[i].n240:=0;
    LineMes[i].n480:=0;
  end;
  
  for x:=0 to 480*2-1 do begin
    xx:=(x-480)*(x-480);
    for y:=0 to 480*2-1 do begin
      yy:=(480-y)*(480-y);
      seta:=round(ArcTan2(round((x-480.0)),round((480.0-y)))*180/pi);
      if(seta<0)    then  seta:=360+seta;
      if(seta>=360) then  seta:=0;
      r:=round(sqrt(xx+yy));
      if(r<480) then begin
         inc(TotalPointNum);
         if(r>240) then begin
            idx:=seta*4000+LineMes[seta].n480;
            p480[idx].x := x - 480 ;
            p480[idx].y := y - 480 ;
            p480[idx].r := r ;
            inc(LineMes[seta].n480);
         end
         else if(r>120) then begin
            idx:=seta*800+LineMes[seta].n240;
            p240[idx].x := x - 480 ;
            p240[idx].y := y - 480 ;
            p240[idx].r := r ;
            inc(LineMes[seta].n240);
         end
         else begin
            idx:=seta*300+LineMes[seta].n120;
            p120[idx].x := x - 480 ;
            p120[idx].y := y - 480 ;
            p120[idx].r := r ;
            inc(LineMes[seta].n120);
         end;
       end;
     end;
  end;  GetMem(pAllPointMes,sizeof(tagPointMes)*totalpointNum);
  pCur := pAllPointMes;
  for i:=0 to numcount do begin
    j:=0;
    LinePointNum:=0;
    LineMes[i].pPMes:=@pCur;
    for j:=0 to LineMes[i].n120 do begin
      jj:=i*300 + j;
      pCur.x := p120[jj].x;
      pCur.y := p120[jj].y;
      pCur.r := p120[jj].r;
      inc(pCur);
    end;    for j:=0 to LineMes[i].n240 do begin
      jj:=i*800 + j;
      pCur.x := p240[jj].x;
      pCur.y := p240[jj].y;
      pCur.r := p240[jj].r;
      inc(pCur);
    end;    for j:=0 to LineMes[i].n480 do begin
      jj:=i*480 + j;
      pCur.x := p480[jj].x;
      pCur.y := p480[jj].y;
      pCur.r := p480[jj].r;
      inc(pCur);
    end;    LineMes[i].n480 :=LineMes[i].n480 +LineMes[i].n240;
  end;
  FreeMem(pAllPointMes)
end;procedure TSA0010.FormCreate(Sender: TObject);
begin
   CacuSinCos;
end;end.

解决方案 »

  1.   

    按(Shift+Ctrl+F11)设置Project/Options/memory sizes/Max Stack Size为:$01000000.
    可以通过你这么巨大的Stack要求:  p120 : Array [0..300*numcount] of tagPointMes;//
      p240 : Array [0..800*numcount] of tagPointMes;
      p480 : Array [0..4000*numcount] of tagPointMes;但并不保证后面的代码通过,不知道程式的意图,无法检查。