Теми рефератів
> Реферати > Курсові роботи > Звіти з практики > Курсові проекти > Питання та відповіді > Ессе > Доклади > Учбові матеріали > Контрольні роботи > Методички > Лекції > Твори > Підручники > Статті Контакти
Реферати, твори, дипломи, практика » Курсовые проекты » Завдання про червоних і синіх точках

Реферат Завдання про червоних і синіх точках





qr (P ^ .X - X) + sqr (P ^ .Y - Y));// обчислення відстані

if (minn lt; 0) then//Первоночально присвоювання:=i;// запам'ятати позиції точки зі списку

minn:=mint; (mint lt; minn) then//пошук чергового мінімуму:=i;:=mint;

end ;; (i_col);// перехід до друнгомк режиму обробки

PPnt (pList.Items [ip2]) ^. Linked:=true;

end; (i_col=0) then//пошук першої точки, максимально близькій до місця натискання

begini:=0 to pList.Count - 1 do//пошук першої точки:=pList.Items [i]; (p ^ .Linked=false):=sqrt (sqr (P ^. X - X) + sqr (P ^ .Y - Y));

if (minn lt; 0) then//Первоночально присвоювання

ip1:=i;:=mint;(mintlt;minn)then:=i;:=mint;;;(i_col);(pList.Items[ip1])^.Linked:=true;;(i_col=2) then//2 точки відібрані?//отрисовка лінії:=pList.Items [ip1];:=pList.Items [ip2];:=sum + sqrt (sqr (P1 ^ .X - P2 ^ .X) + sqr ( P1 ^ .Y -P2 ^ .Y)) ;. Image1.Canvas.MoveTo (p1 ^ .X, p1 ^ .Y); p1 ^ .rColor=1 then Form1.Image1.Canvas.Pen.Color:=clRed; p1 ^ .rColor=2 then Form1.Image1.Canvas.Pen.Color:=clBlue; .Image1.Canvas.LineTo (round ((P1 ^ .X + P2 ^ .X)/2), round ((P1 ^. Y + P2 ^ .Y)/2)); p2 ^ .rColor=1 then Form1.Image1.Canvas.Pen.Color:=clRed; p2 ^ .rColor=2 then Form1.Image1.Canvas.Pen.Color:= clBlue; .Image1.Canvas.LineTo (P2 ^ .X, P2 ^ .Y);

//відображення цифр у табліце.Cells [start, 1]:=IntToStr (P1 ^ .num) + - + IntToStr (P2 ^ .num) ;. Cells [StringGrid1. ColCount - 1,1]:=IntToStr (round (Sum)); (start); _ col:=0 ;; (pList, X, Y); (pList) ;. Caption:= Червоні точки: + IntToStr (redCount) ;. Caption:= Сині точки: + Laquo; + IntToStr (blueCount); redCount=blueCount then Button2.Enabled:=true else Button2.Enabled:=false ;;; TForm1.ToolButton2Click (Sender: TObject);:=2; .Cursor:=crCross ;; TForm1.Button1Click ( Sender: TObject); i: integer ;: PPnt;:=0; _sh:=0; _1:=Start_sh; _2:=0; _1:=0; _2:=0; (pList) ;. Canvas.Pen. Color:=clBlack; .Canvas.Brush.Color:=clWhite; .Canvas.Rectangle (Image1.Canvas.ClipRect) ;;; TForm1.Button2Click (Sender: TObject); rRect: TRect ;: integer ;; (pList); ; (pList) ;; TForm1.Button3Click (Sender: TObject); rRect: TRect; Start=pList.Count then//перебір точок по натисненню кнопки Крок завершено

begin.Caption:= Мінімальна сума відрізків: + FloatToStr (minSum) ;;;:=0; .Clear;

for i:=0 to pList.Count - 1 do//передача усіх точок в тимчасовий список

begin:=pList.Items [i]; (P); ^. X:=Pz.X; ^. Y:=Pz.Y; ^. rColor:=Pz.rColor; ^.Linked:=Pz.Linked; ^. Num:=Pz.Num; .Add (P) ;; i:=start to tmpList.Count - 2 do //:=tmpList.Items [i]; not P ^. Linked then:=MaxInt; j:=0 to tmpList.Count - 1 doi lt; gt; j then:=tmpList.Items [j]; (not P2 ^ .Linked) and (P2 ^ .rColor lt; gt; P ^.rColor) thensqrt (sqr (P ^ .X - P2 ^ .X) + sqr (P ^ .Y - P2 ^ .Y)) lt; Min then:=sqrt (sqr (P ^ .X - P2 ^ .X) + sqr (P ^ .Y - P2 ^ .Y));:=P2 ;;;;:=Sum + Min; ^. Linked: =True; ^. Linked:=True; ^. Num:=P ^ .Num ;;; i:=0 to start - 1 do:=tmpList.Items [i]; not P ^ .Linked then:=MaxInt; j:=0 to tmpList.Count - 1 doi lt; gt; j then:=tmpList.Items [j]; (not P2 ^ .Linked) and (P2 ^ .rColor lt; gt; P ^ .rColor) thensqrt (sqr (P ^ .X - P2 ^ .X) + sqr (P ^ .Y - P2 ^ .Y)) lt; Min then:=sqrt (sqr (P ^ .X - P2 ^ .X) + sqr (P ^ .Y - P2 ^ .Y));:=P2 ;;;;:=Sum + Min; ^. Linked: =True; ^. Linked:=True; ^. Num:=P ^ .Num ;;; start=0 then:=sum; .Clear; _1:=0; i:=0 to tmpList.Count - 1 do: =tmpList.Items [i]; (P); ^. X:=Pz.X; ^. Y:=Pz.Y; ^. rColor:=Pz.rColor; ^. Linked:=Pz.Linked; ^. Num:=Pz.Num; .Add (P) ;; if sum lt; minsum then:=sum; .Clear; i:=0 to tmpList.Count - 1 do:=tmpList.Items [i]; (P); ^ .X:=Pz.X; ^. Y:=Pz.Y; ^. rColor:=Pz.rColor; ^. Linked:=Pz.Linked; ^. Num:=Pz.Num; .Add (P) ;;; _ 1:=0; .RowCount:=start + 2; .ColCount:=REdCount + 2; i:=0 to oList.Count - 1 do:=oList.Items [i]; P ^ .num lt; gt; i + 1 then (i_1) ;. Cells [i_1, start + 1]:=IntToStr (i + 1) + - + IntToStr (p ^ .num) ;. Cells [StringGrid1.ColCount - 1, start + 1]:=FloatToStr (round (minSum)) ;. Cells [i_1,0]:=IntToStr (i_1) ;. Cells [StringGrid1.ColCount - 1,0]:= Сума raquo ;;;;. Cells [0, start + 1]:=IntToStr(start+1);(oList);.Canvas.FillRect(Image1.Canvas.ClipRect);(oList);(start);;TForm1.N4Click(Sender: TObject); (Handle, open , indexm , nil, Nil, SW_ShowNormal) ;; TForm1.N3Click (Sender: TObject) ;. Close ;;.


Назад | сторінка 7 з 7





Схожі реферати:

  • Реферат на тему: Технологія розгортання додатків Java Web Start
  • Реферат на тему: Визначення точки рівноваги прибутку і точки беззбитковості експлуатації вер ...
  • Реферат на тему: Обчислення фізичних параметрів точки
  • Реферат на тему: Розробка програми для вирішення завдання &Знаходження спільної точки N кіл&
  • Реферат на тему: Динаміка матеріальної точки