Курсовая работа: Структура данных программного комплекса Q-дерево
TNodeKind = (nkBranch, nkLeaf);
TPoint = record
X: real;
Y: real;
end;
TRect = record
X1, Y1, X2, Y2: real;
end;
//Массив для хранения точек в листе-----------------
TArrayOfPoints = array[1..M] of TPoint;
//Узел дерева---------------------------------------
PNode = ^TNode;
TNode = packed record
case Kind: TNodeKind of
nkBranch: (SZ, SV, YZ, YV: PNode);
nkLeaf: (Points: TArrayOfPoints;
PointsCount: integer);
end;
function InsertPoint(var Node: PNode; Bounds: TRect; Point: TPoint): boolean;
procedure DeletePoint(var Node: PNode; Bounds: TRect; Point: TPoint);
procedure ClearTree(var Node: PNode);
function Find(Node: PNode; const Bounds, Rect: TRect): TList;
implementation
//Установка характеристик нового листа =======================================
procedure SetProperties(var ChildNode: PNode);
begin
New(ChildNode);
ChildNode^.Kind:= nkLeaf;
ChildNode^.PointsCount:= 0; //в массиве нет точек