Advertisement
Guest User

TInterpolator

a guest
Jul 11th, 2011
767
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 23.58 KB | None | 0 0
  1. {*******************************************************}
  2. {*
  3. {* uTInterpolator.pas
  4. {* Delphi Implementation of the Class TInterpolator
  5. {* Generated by Enterprise Architect
  6. {* Created on:      15-сен-2008 14:08:09
  7. {* Original author: Denis Saponenko
  8. {*  
  9. {*******************************************************}
  10.  
  11. unit uTInterpolator;
  12.  
  13. interface
  14.  
  15. uses
  16.   Classes, math, SysUtils, windows,
  17.   uTRegion, uTPoints, uTScales, uGlobalFunctions;
  18.  
  19. type
  20.   EInterpolatorError = class(Exception);
  21.  
  22.   TInterpolator = class
  23.   private
  24.     FNilH2: THeight; // Вторая нулевая глубина, которой замешаем линию
  25.     FNilH3: THeight;
  26.     FRegion: TRegion; // Интерполируемый регион
  27.  
  28.     // Выдает строку с текущей информацией о ходе обработки
  29.     FOutIterNow: TGetStrProc;
  30.  
  31.     // Начало интерполяции
  32.     procedure StartInterpolation();
  33.  
  34.     // Получение высоты в точке с координатами x, y
  35.     function GetHinPoint(const x, y: TCoord): THeight;
  36.  
  37.     // Вычисление высоты по заданным точкам
  38.     function CalcHeightInPoint(const x, y: TCoord;
  39.                                const HPoint1, Hpoint2, HPoint3: THPoint): THeight;
  40.                                
  41.     // Функция вычисления высоты по друм точкам
  42.     function CalcHeightPer2Point(const Height1, Height2: THeight;
  43.                                  const RToHeight1, RToHeight2: double): THeight;
  44.  
  45.     // Функция вычисления высоты по друм точкам
  46.     function CalcHeightPer3Point(const Height1, Height2, Height3: THeight;
  47.                                  const RToHeight1, RToHeight2, RToHeight3: double): THeight;
  48.  
  49.     // Поиск трех ближайших точек разной высоты
  50.     procedure Get3NearH(var HPoint1, Hpoint2, HPoint3: THPoint; const x, y: TCoord);
  51.  
  52.     // Вычисление максимальной длины половины ребра квадрата для обхода
  53.     function CalcMaxSquareRibDiv2(const x, y: TCoord; const MapScale: TScale): TCoord;
  54.  
  55.     // Поиск ближайшей точки
  56.     procedure GetNearH(var NearHPoint: THPoint; var SquareRibDiv2: TCoord;
  57.                        MaxSquareRibDiv2: TCoord; const x, y: TCoord);
  58.  
  59.     // Поиск Ближайшей точки (первое приближение)
  60.     procedure SearchNearPoint(var NearHPoint: THPoint; var SquareRibDiv2: TCoord;
  61.                               const x, y, MaxSquareRibDiv2: TCoord);
  62.  
  63.     // Корректировка найденной приблизительно точки (второе приближение)
  64.     procedure CorrectionNearPoint(var NearHPoint: THPoint; var SquareRibDiv2: TCoord;
  65.                                   const x, y: TCoord; MaxSquareRibDiv2: TCoord);
  66.  
  67.     // Поиск по периметру квадрата
  68.     procedure PPK(var HPoint: THPoint; const SquareRibDiv2, XCenter, YCenter: TCoord);
  69.  
  70.     // Инициализация значениями Max, Min для прохода области по стороне квадрата
  71.     procedure InitMaxMinForSide(var Min, Max: TCoord;
  72.                                 const SquareRibDiv2, MapSideSize, SquareCenter: TCoord);
  73.     // Вычисление точки и минимального расстояния до нее от центральной
  74.     procedure CalcHPointAndRMin(var HPoint: THPoint; var RMin: double;
  75.                                 const x, y, XCenter, YCenter: TCoord);
  76.  
  77.     // Проверка, подходит ли точка
  78.     function IsPointSuit(const x, y: TCoord; const HInPoint: THeight;
  79.                          const XCenter, YCenter: TCoord;
  80.                          const RMin: double): boolean;
  81.  
  82.     // Запись точки с указанными параметрами
  83.     procedure WriteToPoint(var HPoint: THPoint; const x, y: TCoord;
  84.                            const Height: THeight);
  85.  
  86.     // Проверка принадлежности точки рабочей зоне (огр. изолиниями)
  87.     function IsHInWorkZone(const x, y, XCenter, YCenter: TCoord): Boolean;
  88.  
  89.     // Инициализация параметров для IsHInWorkZone
  90.     procedure InitSideParametrs(var dCoord: TCoord; var IncCoord: shortint;
  91.                                 const SideCoord, CoordCenter: TCoord);
  92.  
  93.     function SelectProjectionLen(const dX, dY: TCoord): TCoord;
  94.  
  95.     // Получение статуса состояния
  96.     function PointState(const x, y: TCoord; const IncX, Incremented: shortint): boolean;
  97.  
  98.     // Проверка высоты на равенство нулевым высотам
  99.     function IsHeightNotEqualNilHs(const Height: THeight): boolean;
  100.  
  101.   public
  102.     // Точка входа
  103.     procedure Interpolate(var Region: TRegion; const OutIterNow: TGetStrProc = nil);
  104.  
  105.     property OutIterNow: TGetStrProc read FOutIterNow;
  106.  
  107.     constructor Create; overload;
  108.     destructor Destroy; override;
  109.   end;
  110.  
  111. implementation
  112.  
  113. resourcestring
  114.   SRegionNotInited = 'Передан неинициализированный регион';
  115.  
  116. {implementation of TInterpolator}
  117.  
  118. constructor TInterpolator.Create;
  119. begin
  120.   inherited Create;
  121.   FRegion := nil;
  122.   FOutIterNow := nil;
  123. end;
  124.  
  125. destructor TInterpolator.Destroy;
  126. begin
  127.   FRegion := nil;
  128.   FOutIterNow := nil;
  129.   inherited Destroy;
  130. end;
  131.  
  132. {==============================================================================}
  133. { Интерполяция региона                                                         }
  134. {==============================================================================}
  135. procedure TInterpolator.Interpolate(var Region: TRegion;
  136.                                     const OutIterNow: TGetStrProc = nil);
  137. begin
  138.   if (Region = nil) then
  139.     raise EInterpolatorError.Create(SRegionNotInited);
  140.   FRegion := Region;
  141.   FNilH2 := NilH;
  142.   FNilH3 := NilH;
  143.   FOutIterNow := OutIterNow;
  144.   StartInterpolation();
  145. end;
  146.  
  147. {==============================================================================}
  148. { Начало интерполяции                                                          }
  149. {==============================================================================}
  150. procedure TInterpolator.StartInterpolation();
  151. var
  152.   XIdx, YIdx: TCoord;
  153. begin
  154.   for XIdx := FRegion.Header.Scale.X0 to FRegion.Header.Scale.X1 do
  155.     for YIdx := FRegion.Header.Scale.Y0 to FRegion.Header.Scale.Y1 do
  156.     begin
  157.       if (Assigned(FOutIterNow)) then
  158.         OutIterNow(IntToStr(XIdx) + ': ' + IntToStr(YIdx));
  159.       FRegion.HInPoint[XIdx - FRegion.Header.Scale.X0, YIdx - FRegion.Header.Scale.Y0] := GetHInPoint(XIdx, YIdx);
  160.     end;
  161. end;
  162.  
  163. {==============================================================================}
  164. { Получение высоты в точке с координатами x, y                                 }
  165. { на карте с неравномерной сеткой                                              }
  166. {==============================================================================}
  167. function TInterpolator.GetHInPoint(const x, y: TCoord): THeight;
  168. var
  169.   HPoint1, HPoint2, HPoint3: THPoint;
  170. begin
  171.   if (IsHeightEqual(FRegion.MapContain.HInPoint[x, y], NilH)) then
  172.   begin
  173.     Get3NearH(HPoint1, HPoint2, HPoint3, x, y);
  174.     result := CalcHeightInPoint(x, y, HPoint1, HPoint2, HPoint3);
  175.   end
  176.   else
  177.     result := FRegion.MapContain.HInPoint[x, y];
  178. end;
  179.  
  180. {==============================================================================}
  181. {Поиск трех ближайших точек, если их меньше то цвет ненайденных точек          }
  182. {устанавливается в NilH                                                        }
  183. {==============================================================================}
  184. procedure TInterpolator.Get3NearH(var HPoint1, Hpoint2, HPoint3: THPoint; const x, y: TCoord);
  185. var
  186.   SquareRibDiv2, MaxSquareRibDiv2: TCoord;
  187. begin
  188.   FNilH2 := NilH;
  189.   FNilH3 := NilH;
  190.   SquareRibDiv2 := 1;
  191.   MaxSquareRibDiv2 := CalcMaxSquareRibDiv2(x, y, FRegion.MapContain.Header.Scale);
  192.   // ищем первую точку
  193.   GetNearH(HPoint1, SquareRibDiv2, MaxSquareRibDiv2, x, y);
  194.   // если точка имеет высоту, то она найдена, ищем вторую
  195.   if (not IsHeightEqual(HPoint1.H, NilH)) then
  196.   begin
  197.     FNilH2 := HPoint1.H;
  198.     GetNearH(HPoint2, SquareRibDiv2, MaxSquareRibDiv2, x, y);
  199.     if (not IsHeightEqual(HPoint2.H, NilH)) then
  200.     begin
  201.       FNilH3 := HPoint2.H;
  202.       GetNearH(HPoint3, SquareRibDiv2, MaxSquareRibDiv2, x, y);
  203.     end;
  204.   end;
  205. end;
  206.  
  207. {==============================================================================}
  208. { Вычисление высоты по заданным точкам                                         }
  209. {==============================================================================}
  210. function TInterpolator.CalcHeightInPoint(const x, y: TCoord;
  211.                                          const HPoint1, Hpoint2,
  212.                                           HPoint3: THPoint): THeight;
  213. var
  214.   RToPoint1, RToPoint2, RToPoint3: double;
  215. begin
  216.   if (IsHeightEqual(HPoint2.H, NilH)) then
  217.     result := HPoint1.H
  218.   else
  219.   begin
  220.     RToPoint1 := hypot(HPoint1.X - x, HPoint1.Y - y);
  221.     RToPoint2 := hypot(HPoint2.X - x, HPoint2.Y - y);
  222.     if (IsHeightEqual(HPoint3.H, NilH)) then
  223.       result := CalcHeightPer2Point(HPoint1.H, HPoint2.H, RToPoint1, RToPoint2)
  224.     else
  225.     begin
  226.       RToPoint3 := hypot(HPoint3.X - x, HPoint3.Y - y);
  227.       result := CalcHeightPer3Point(HPoint1.H, HPoint2.H, HPoint3.H, RToPoint1, RToPoint2, RToPoint3);
  228.     end;
  229.   end;
  230. end;
  231.  
  232. {==============================================================================}
  233. { Вычисление высоты по трем ближайшим высотам и расстоянию до них              }
  234. {==============================================================================}
  235. function TInterpolator.CalcHeightPer2Point(const Height1, Height2: THeight;
  236.                                            const RToHeight1, RToHeight2: double): THeight;
  237. begin
  238.   result := trunc((Height1 * RToHeight2 + Height2 * RToHeight1)
  239.                  / (RToHeight1 + RToHeight2));
  240. end;
  241.  
  242. function TInterpolator.CalcHeightPer3Point(const Height1, Height2, Height3: THeight;
  243.                                            const RToHeight1, RToHeight2, RToHeight3: double): THeight;
  244. begin
  245.   result := trunc((Height1 * RToHeight2 * RToHeight3 +
  246.                    Height2 * RToHeight1 * RToHeight3 +
  247.                    Height3 * RToHeight1 * RToHeight2)
  248.                  / (RToHeight1 * RToHeight2 +
  249.                     RToHeight1 * RToHeight3 +
  250.                     RToHeight2 * RToHeight3));
  251. end;
  252.  
  253. {==============================================================================}
  254. { Поиск ближайшей точки                                                        }
  255. {==============================================================================}
  256. procedure TInterpolator.GetNearH(var NearHPoint: THPoint; var SquareRibDiv2: TCoord;
  257.                                  MaxSquareRibDiv2: TCoord; const x, y: TCoord);
  258. begin
  259.   // Поиск ближайшей точки (первое приближение)
  260.   SearchNearPoint(NearHPoint, SquareRibDiv2, x, y, MaxSquareRibDiv2);
  261.   // Поиск ближайшей точки (второе приближение)
  262.   CorrectionNearPoint(NearHPoint, SquareRibDiv2, x, y, MaxSquareRibDiv2);
  263. end;
  264.  
  265. {==============================================================================}
  266. { Вычисление максимальной длины половины ребра квадрата для обхода             }
  267. {==============================================================================}
  268. function TInterpolator.CalcMaxSquareRibDiv2(const x, y: TCoord; const MapScale: TScale): TCoord;
  269. var
  270.   MaxSquareRibDiv2: TCoord;
  271. begin
  272.   MaxSquareRibDiv2 := MapScale.X1 - MapScale.X0;
  273.   if (MaxSquareRibDiv2 > MapScale.Y1 - MapScale.Y0) then
  274.   begin
  275.     if ((MaxSquareRibDiv2 shr 1) < x) then
  276.       MaxSquareRibDiv2 := x
  277.     else
  278.       MaxSquareRibDiv2 := MaxSquareRibDiv2 - x;
  279.   end
  280.   else
  281.   begin
  282.     MaxSquareRibDiv2 := MapScale.Y1 - MapScale.Y0;
  283.     if ((MaxSquareRibDiv2 shr 1) < y) then
  284.       MaxSquareRibDiv2 := y
  285.     else
  286.       MaxSquareRibDiv2 := MaxSquareRibDiv2 - y;
  287.   end;
  288.   result := MaxSquareRibDiv2;
  289. end;
  290.  
  291. {==============================================================================}
  292. { Поиск Ближайшей точки (первое приближение)                                   }
  293. {==============================================================================}
  294. procedure TInterpolator.SearchNearPoint(var NearHPoint: THPoint; var SquareRibDiv2: TCoord;
  295.                                         const x, y, MaxSquareRibDiv2: TCoord);
  296. begin
  297.   NearHPoint.H := NilH;
  298.   while ((not IsHeightNotEqualNilHs(NearHPoint.H)) and
  299.          (SquareRibDiv2 <= MaxSquareRibDiv2)) do
  300.   begin
  301.     PPK(NearHPoint, SquareRibDiv2, x, y);
  302.     inc(SquareRibDiv2);
  303.   end;
  304. end;
  305.  
  306. {==============================================================================}
  307. { Корректировка найденной приблизительно точки (второе приближение)            }
  308. {==============================================================================}
  309. procedure TInterpolator.CorrectionNearPoint(var NearHPoint: THPoint; var SquareRibDiv2: TCoord;
  310.                                             const x, y: TCoord; MaxSquareRibDiv2: TCoord);
  311. var
  312.   RibToPoint: TCoord; // Расстояние до точки по вертикали либо по горизонтали
  313.   RToPoint, RToPoint2: double;
  314.   WorkHPoint: THPoint;
  315. begin
  316.   RibToPoint := SquareRibDiv2 - 1;
  317.   if (not IsHeightEqual(NearHPoint.H, NilH)) then
  318.   begin
  319.     WorkHPoint := NearHPoint;
  320.     WorkHPoint.H := NilH;
  321.     RToPoint := hypot(WorkHPoint.X - x, WorkHPoint.Y - y);
  322.     if (SquareRibDiv2 < RToPoint) then
  323.     begin
  324.       MaxSquareRibDiv2 := floor(RToPoint);
  325.       while (SquareRibDiv2 < MaxSquareRibDiv2) do
  326.       begin
  327.         PPK(WorkHPoint, SquareRibDiv2, x, y);
  328.         RToPoint2 := hypot(WorkHPoint.X - x, WorkHPoint.Y - y);
  329.         if (IsHeightNotEqualNilHs(WorkHPoint.H) and (RToPoint2 < RToPoint)) then
  330.         begin
  331.           RToPoint := RToPoint2;
  332.           NearHPoint := WorkHPoint;
  333.           RibToPoint := SquareRibDiv2;
  334.         end;
  335.         inc(SquareRibDiv2);
  336.       end; // while (l < lmax)
  337.     end; // if (RNearPoint > l)
  338.   end; // if (HNearPoint <> NilH)
  339.   SquareRibDiv2 := RibToPoint;
  340. end;
  341.  
  342. {==============================================================================}
  343. {Поиск по периметру квадрата                                                   }
  344. {==============================================================================}
  345. {Rmin - минимальное растояние до ближайшей точки                               }
  346. {HPoint - Высота ближайшей точки                                               }
  347. {SquareRibDiv2 - Половина ребра квадрата, по которому совершаем обход          }
  348. {XCenter, YCenter - координаты точки, для которой выполняем поиск              }
  349. {==============================================================================}
  350. procedure TInterpolator.PPK(var HPoint: THPoint;
  351.                             const SquareRibDiv2, XCenter, YCenter: TCoord);
  352. var
  353.   x, y, SideMax, SideMin: TCoord;
  354.   MapXSize, MapYSize: TCoord;
  355.   RMin: double;
  356. begin
  357.   RMin := High(SquareRibDiv2);
  358.   MapXSize := FRegion.MapContain.Header.Scale.X1 - FRegion.MapContain.Header.Scale.X0;
  359.   MapYSize := FRegion.MapContain.Header.Scale.Y1 - FRegion.MapContain.Header.Scale.Y0;
  360.   InitMaxMinForSide(SideMin, SideMax, SquareRibDiv2, MapYSize, YCenter);
  361.  
  362.   // обход левого ребра квадрата
  363.   if (SquareRibDiv2 <= XCenter) then
  364.   begin
  365.     x := XCenter - SquareRibDiv2;
  366.     for y := SideMin to SideMax do
  367.       CalcHPointAndRMin(HPoint, RMin, x, y, XCenter, YCenter);
  368.   end;
  369.  
  370.   // обход правого ребра квадрата
  371.   if (SquareRibDiv2 <= MapXSize - XCenter) then
  372.   begin
  373.     x := XCenter + SquareRibDiv2;
  374.     for y := SideMin to SideMax do
  375.       CalcHPointAndRMin(HPoint, RMin, x, y, XCenter, YCenter);
  376.   end;
  377.  
  378.   InitMaxMinForSide(SideMin, SideMax, SquareRibDiv2, MapXSize, XCenter);
  379.  
  380.   // обход верхнего ребра квадрата
  381.   if (SquareRibDiv2 <= YCenter) then
  382.   begin
  383.     y := YCenter - SquareRibDiv2;
  384.     for x := SideMin to SideMax do
  385.       CalcHPointAndRMin(HPoint, RMin, x, y, XCenter, YCenter);
  386.   end;
  387.  
  388.   // обход нижнего ребра квадрата
  389.   if (SquareRibDiv2 <= MapYSize - YCenter) then
  390.   begin
  391.     y := YCenter + SquareRibDiv2;
  392.     for x := SideMin to SideMax do
  393.       CalcHPointAndRMin(HPoint, RMin, x, y, XCenter, YCenter);
  394.   end;
  395. end;
  396.  
  397. {==============================================================================}
  398. { Инициализация значениями Max, Min для прохода области по стороне квадрата    }
  399. {==============================================================================}
  400. procedure TInterpolator.InitMaxMinForSide(var Min, Max: TCoord;
  401.                                           const SquareRibDiv2, MapSideSize,
  402.                                             SquareCenter: TCoord);
  403. begin
  404.   if (SquareCenter > SquareRibDiv2) then
  405.     Min := SquareCenter - SquareRibDiv2
  406.   else
  407.     Min := 0;
  408.   if ((MapSideSize - SquareCenter) > SquareRibDiv2) then
  409.     Max := SquareCenter + SquareRibDiv2
  410.   else
  411.     Max := MapSideSize;
  412. end;
  413.  
  414. {==============================================================================}
  415. { Вычисление точки и минимального расстояния до нее от центральной             }
  416. {==============================================================================}
  417. procedure TInterpolator.CalcHPointAndRMin(var HPoint: THPoint; var RMin: double;
  418.                                           const x, y, XCenter, YCenter: TCoord);
  419. var
  420.   HInPoint: THeight;
  421. begin
  422.   HInPoint := FRegion.MapContain.HInPoint[x, y];
  423.   if (IsPointSuit(x, y, HInPoint, XCenter, YCenter, RMin)) then
  424.   begin
  425.     WriteToPoint(HPoint, x, y, HInPoint);
  426.     RMin := hypot(x - XCenter, y - YCenter);
  427.   end;
  428. end;
  429.  
  430. {==============================================================================}
  431. { Проверка, подходит ли точка                                                  }
  432. {==============================================================================}
  433. function TInterpolator.IsPointSuit(const x, y: TCoord; const HInPoint: THeight;
  434.                                    const XCenter, YCenter: TCoord;
  435.                                    const RMin: double): boolean;
  436. var
  437.   R: double;
  438. begin
  439.   result := false;
  440.   if (IsHeightNotEqualNilHs(HInPoint)) then
  441.   begin
  442.     R := hypot(x - XCenter, y - YCenter);
  443.     if (R < RMin) then
  444.       result := IsHInWorkZone(x, y, XCenter, YCenter);
  445.   end;
  446. end;
  447.  
  448. {==============================================================================}
  449. { Запись точки с указанными параметрами                                        }
  450. {==============================================================================}
  451. procedure TInterpolator.WriteToPoint(var HPoint: THPoint; const x, y: TCoord;
  452.                                      const Height: THeight);
  453. begin
  454.   HPoint.X := x;
  455.   HPoint.Y := y;
  456.   HPoint.H := Height;
  457. end;
  458.  
  459. {==============================================================================}
  460. { Проверка принадлежности найденной точки рабочей зоне                         }
  461. {==============================================================================}
  462. { Используется алгоритм Брезенхема                                             }
  463. {==============================================================================}
  464. function TInterpolator.IsHInWorkZone(const x, y, XCenter, YCenter: TCoord): Boolean;
  465. var
  466.   XError, YError: double;
  467.   XWork, YWork: TCoord;
  468.   WorkCoord, ProjectionLen, ProjectionX, ProjectionY: TCoord;
  469.   IncX, IncY: shortint;
  470.   Incremented: shortint;
  471.   IsStateCorrect: boolean;
  472. begin
  473.   InitSideParametrs(ProjectionX, IncX, x, XCenter);
  474.   InitSideParametrs(ProjectionY, IncY, y, YCenter);
  475.   ProjectionLen := SelectProjectionLen(ProjectionX, ProjectionY);
  476.   XWork := XCenter;
  477.   YWork := YCenter;
  478.   XError := 0;
  479.   YError := 0;
  480.   WorkCoord := 1;
  481.   IsStateCorrect := true;
  482.   while (IsStateCorrect and (WorkCoord <= ProjectionLen)) do
  483.   begin
  484.     Incremented := 0;
  485.     XError := XError + ProjectionX;
  486.     YError := YError + ProjectionY;
  487.     if (ProjectionLen < XError) then
  488.     begin
  489.       XError := XError - ProjectionLen;
  490.       XWork := XWork + IncX;
  491.       inc(Incremented);
  492.     end;
  493.     if (ProjectionLen < YError) then
  494.     begin
  495.       YError := YError - ProjectionLen;
  496.       YWork := YWork + IncY;
  497.       inc(Incremented);
  498.     end;
  499.     IsStateCorrect := PointState(XWork, YWork, IncX, Incremented);
  500.     inc(WorkCoord);
  501.   end;
  502.   result := IsStateCorrect;
  503. end;
  504.  
  505. {==============================================================================}
  506. { Инициализация параметров сторон для IsHInWorkZone                            }
  507. {==============================================================================}
  508. procedure TInterpolator.InitSideParametrs(var dCoord: TCoord; var IncCoord: shortint;
  509.                                           const SideCoord, CoordCenter: TCoord);
  510. begin
  511.   if (SideCoord < CoordCenter) then
  512.     IncCoord := -1
  513.   else
  514.     if (SideCoord > CoordCenter) then
  515.       IncCoord := 1
  516.     else
  517.       IncCoord := 0;
  518.   dCoord := abs(SideCoord - CoordCenter);
  519. end;
  520.  
  521. {==============================================================================}
  522. { Выбор длины проекции для IsHInWorkZone                                       }
  523. {==============================================================================}
  524. function TInterpolator.SelectProjectionLen(const dX, dY: TCoord): TCoord;
  525. begin
  526.   if (dY < dX) then
  527.     result := dX
  528.   else
  529.     result := dY;
  530. end;
  531.  
  532. {==============================================================================}
  533. { Получение статуса точки                                                      }
  534. {==============================================================================}
  535. function TInterpolator.PointState(const x, y: TCoord;
  536.                                   const IncX, Incremented: shortint): boolean;
  537. begin
  538.   result := IsHeightEqual(FRegion.MapContain.HInPoint[x, y], NilH);
  539.   if (2 <= Incremented) then
  540.     result := result and IsHeightEqual(FRegion.MapContain.HInPoint[x - IncX, y], NilH);
  541. end;
  542.  
  543. {==============================================================================}
  544. { Проверка высоты на равенство нулевым высотам                                 }
  545. {==============================================================================}
  546. function TInterpolator.IsHeightNotEqualNilHs(const Height: THeight): boolean;
  547. begin
  548.   result := not (IsHeightEqual(Height, NilH) or
  549.                  IsHeightEqual(Height, FNilH2) or
  550.                  IsHeightEqual(Height, FNilH3));
  551. end;
  552.  
  553. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement