1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-30 04:42:21 -05:00
Simba/Doc/sphinx/scriptref/tpa.rst

835 lines
18 KiB
ReStructuredText
Raw Normal View History

2010-09-09 11:53:07 -04:00
.. _scriptref_tpa:
TPointArray Functions
=====================
Quicksort
---------
.. code-block:: pascal
procedure Quicksort(var Arr : TIntegerArray);
Sorts a TIntegerArray using the Quicksort algorithm
2010-09-09 11:53:07 -04:00
tSwap
-----
.. code-block:: pascal
procedure tSwap(var a, b: TPoint);
Swaps the values of a and b around
2010-09-09 11:53:07 -04:00
tpaSwap
-------
.. code-block:: pascal
procedure tpaSwap(var a, b: TPointArray);
Swaps the values of a and b around
2010-09-09 11:53:07 -04:00
SwapE
-----
.. code-block:: pascal
procedure SwapE(var a, b: Extended);
Swaps the values of a and b around
2010-09-09 11:53:07 -04:00
RAaSTPAEx
---------
.. code-block:: pascal
procedure RAaSTPAEx(var a: TPointArray; const w, h: Integer);
Leaves one point per box with side lengths W and H to the TPA
2010-09-09 11:53:07 -04:00
RAaSTPA
-------
.. code-block:: pascal
procedure RAaSTPA(var a: TPointArray; const Dist: Integer);
Leaves one point per box with the side length Dist
2010-09-09 11:53:07 -04:00
NearbyPointInArrayEx
--------------------
.. code-block:: pascal
function NearbyPointInArrayEx(const P: TPoint; w, h:Integer;const a: TPointArray): Boolean;
Returns true if the point P is near a point in the TPA a with the
2010-09-09 11:53:07 -04:00
NearbyPointInArray
------------------
.. code-block:: pascal
function NearbyPointInArray(const P: TPoint; Dist:Integer;const a: TPointArray): Boolean;
Returns true if the point P is near a point in the TPA a with the
2010-09-09 11:53:07 -04:00
QuickTPASort
------------
.. code-block:: pascal
procedure QuickTPASort(var A: TIntegerArray; var B: TPointArray; iLo, iHi: Integer; SortUp: Boolean);
QuickATPASort
-------------
.. code-block:: pascal
procedure QuickATPASort(var A: TIntegerArray; var B: T2DPointArray; iLo, iHi: Integer; SortUp: Boolean);
SortTPAFrom
-----------
.. code-block:: pascal
procedure SortTPAFrom(var a: TPointArray; const From: TPoint);
Sorts the TPA a from the TPoint From
2010-09-09 11:53:07 -04:00
SortATPAFrom
------------
.. code-block:: pascal
procedure SortATPAFrom(var a: T2DPointArray; const From: TPoint);
Sorts the T2DPointArray a from the TPoint From
2010-09-09 11:53:07 -04:00
SortATPAFromFirstPoint
----------------------
.. code-block:: pascal
procedure SortATPAFromFirstPoint(var a: T2DPointArray; const From: TPoint);
InvertTPA
---------
.. code-block:: pascal
procedure InvertTPA(var a: TPointArray);
Reverses the TPA
2010-09-09 11:53:07 -04:00
InvertATPA
----------
.. code-block:: pascal
procedure InvertATPA(var a: T2DPointArray);
Reverses the T2dPointArray
2010-09-09 11:53:07 -04:00
MiddleTPAEx
-----------
.. code-block:: pascal
function MiddleTPAEx(const TPA: TPointArray; var x, y: Integer): Boolean;
Stores the middle point from the TPA in x and y
2010-09-09 11:53:07 -04:00
MiddleTPA
---------
.. code-block:: pascal
function MiddleTPA(const tpa: TPointArray): TPoint;
Returns the middle TPA in the result
2010-09-09 11:53:07 -04:00
SortATPASize
------------
.. code-block:: pascal
procedure SortATPASize(var a: T2DPointArray; const BigFirst: Boolean);
Sorts the T2dPointArray from largest to smallest if BigFirst is true or smallest to largest if BigFirst is false
2010-09-09 11:53:07 -04:00
SortATPAFromSize
----------------
.. code-block:: pascal
procedure SortATPAFromSize(var a: T2DPointArray; const Size: Integer; CloseFirst: Boolean);
Sorts the T2DPointArray from Size by the closest first if CloseFirst is true
2010-09-09 11:53:07 -04:00
InIntArrayEx
------------
.. code-block:: pascal
function InIntArrayEx(const a: TIntegerArray; var Where: Integer; const Number: Integer): Boolean;
Returns true if Number was found in the TIntegerArray a and returns its location in Where
2010-09-09 11:53:07 -04:00
InIntArray
----------
.. code-block:: pascal
function InIntArray(const a: TIntegerArray; Number: Integer): Boolean;
Returns true if Number is found in the TintegerArray a
2010-09-09 11:53:07 -04:00
ClearSameIntegers
-----------------
.. code-block:: pascal
procedure ClearSameIntegers(var a: TIntegerArray);
Deletes the indexes in the TintegerArray a which are duplicated
2010-09-09 11:53:07 -04:00
ClearSameIntegersAndTPA
-----------------------
.. code-block:: pascal
procedure ClearSameIntegersAndTPA(var a: TIntegerArray; var p: TPointArray);
Deletes the indexes in the TIntegerArray a and TPointArray p which are duplicated
2010-09-09 11:53:07 -04:00
SplitTPAEx
----------
.. code-block:: pascal
function SplitTPAEx(const arr: TPointArray; w, h: Integer): T2DPointArray;
Splits the points with max X and Y distances W and H to their
2010-09-09 11:53:07 -04:00
SplitTPA
--------
.. code-block:: pascal
function SplitTPA(const arr: TPointArray; Dist: Integer): T2DPointArray;
Splits the points with max distance Dist to their own TPointArrays
2010-09-09 11:53:07 -04:00
FloodFillTPA
------------
.. code-block:: pascal
function FloodFillTPA(const TPA : TPointArray) : T2DPointArray;
FilterPointsPie
---------------
.. code-block:: pascal
procedure FilterPointsPie(var Points: TPointArray; const SD, ED, MinR, MaxR: Extended; Mx, My: Integer);
Removes the points that are in the TPointArray Points that are not within the the degrees SD (Strat Degrees) and
ED (End Degrees) and the radius' MinR (Min Radius) and MaxR (Max Radius) from the origin Mx and My
2010-09-09 11:53:07 -04:00
FilterPointsLine
----------------
.. code-block:: pascal
procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);
Returns the result in the TPointArray Points. Returns the points from the TPointArray Points that are on the line Radial from the center mx, my that is with the radius Radius
2010-09-09 11:53:07 -04:00
FilterPointsDist
----------------
.. code-block:: pascal
procedure FilterPointsDist(var Points: TPointArray; const MinDist, MaxDist: Extended; Mx, My: Integer);
Removes the points from the TPointArray Points that are not within the radius MinDist (Min Distance) and MaxDist
from the origin Mx and My
2010-09-09 11:53:07 -04:00
GetATPABounds
-------------
.. code-block:: pascal
function GetATPABounds(const ATPA: T2DPointArray): TBox;
Returns the boundaries of the T2DPointArray ATPA as a TBox
2010-09-09 11:53:07 -04:00
GetTPABounds
------------
.. code-block:: pascal
function GetTPABounds(const TPA: TPointArray): TBox;
Returns the boundaries of the TPointArray TPA as a TBox
2010-09-09 11:53:07 -04:00
FindTPAinTPA
------------
.. code-block:: pascal
function FindTPAinTPA(const SearchTPA, TotalTPA: TPointArray; var Matches: TPointArray): Boolean;
Looks for the TPoints from SearchTPA inside TotalTPA and stores the matches inside the TPointArray Matches
2010-09-09 11:53:07 -04:00
GetSamePointsATPA
-----------------
.. code-block:: pascal
function GetSamePointsATPA(const ATPA : T2DPointArray; var Matches : TPointArray) : boolean;
Finds duplicate Points inside the T2DPointArray ATPA and stores the results inside the TPointArray Matches
2010-09-09 11:53:07 -04:00
FindTextTPAinTPA
----------------
.. code-block:: pascal
function FindTextTPAinTPA(Height : integer;const SearchTPA, TotalTPA: TPointArray; var Matches: TPointArray): Boolean;
Looks for the TPoints from SearchTPA inside TotalTPA with a maximum y distance of Height and stores the matches inside the TPointArray Matches
2010-09-09 11:53:07 -04:00
SortCircleWise
--------------
.. code-block:: pascal
procedure SortCircleWise(var tpa: TPointArray; const cx, cy, StartDegree: Integer; SortUp, ClockWise: Boolean);
Sorts the TPointArray tpa from the point cx, cy if Sortup is true. Starting at StartDegree going clockwise if Clockwise is True
2010-09-09 11:53:07 -04:00
LinearSort
----------
.. code-block:: pascal
procedure LinearSort(var tpa: TPointArray; cx, cy, sd: Integer; SortUp: Boolean);
Sorts the TPointArray tpa from cx, cy if Sortup is true on the degree angle sd
2010-09-09 11:53:07 -04:00
RotatePoint
-----------
.. code-block:: pascal
function RotatePoint(Const p: TPoint; angle, mx, my: Extended): TPoint;
Rotates the TPoint p around the center mx, my with the angle
2010-09-09 11:53:07 -04:00
ChangeDistPT
------------
.. code-block:: pascal
function ChangeDistPT(const PT : TPoint; mx,my : integer; newdist : extended) : TPoint;
Returns a TPoint with the distance newdist from the point mx, my based on the position of the TPoint TP
2010-09-09 11:53:07 -04:00
ChangeDistTPA
-------------
.. code-block:: pascal
function ChangeDistTPA(var TPA : TPointArray; mx,my : integer; newdist : extended) : boolean;
Returns the result in the TPointArray TPA with the distance newdist from mx, my based on the current position TPA
2010-09-09 11:53:07 -04:00
FindGapsTPA
-----------
.. code-block:: pascal
function FindGapsTPA(const TPA: TPointArray; MinPixels: Integer): T2DPointArray;
Finds the possible gaps in the TPointArray TPA and results the gaps as a T2DPointArray. Considers as a gap if the gap length is >= MinPixels
2010-09-09 11:53:07 -04:00
RemoveDistTPointArray
---------------------
.. code-block:: pascal
function RemoveDistTPointArray(x, y, dist: Integer;const ThePoints: TPointArray; RemoveHigher: Boolean): TPointArray;
Finds the possible gaps in the TPointArray TPA and removes the gaps. Considers as a gap if the gap length is >= MinPixels
2010-09-09 11:53:07 -04:00
CombineTPA
----------
.. code-block:: pascal
function CombineTPA(const Ar1, Ar2: TPointArray): TPointArray;
Attaches the TPointArray Ar2 onto the end of Ar1 and returns it as the result
2010-09-09 11:53:07 -04:00
ReArrangeandShortenArrayEx
--------------------------
.. code-block:: pascal
function ReArrangeandShortenArrayEx(const a: TPointArray; w, h: Integer): TPointArray;
Results the TPointArray a with one point per box with side lengths W and H left
2010-09-09 11:53:07 -04:00
ReArrangeandShortenArray
------------------------
.. code-block:: pascal
function ReArrangeandShortenArray(const a: TPointArray; Dist: Integer): TPointArray;
Results the TPointArray a with one point per box with side length Dist left
2010-09-09 11:53:07 -04:00
TPAtoATPAEx
-----------
.. code-block:: pascal
function TPAtoATPAEx(const TPA: TPointArray; w, h: Integer): T2DPointArray;
Splits the TPA to boxes with sidelengths W and H and results them as a T2DPointArray
2010-09-09 11:53:07 -04:00
TPAtoATPA
---------
.. code-block:: pascal
function TPAtoATPA(const TPA: TPointArray; Dist: Integer): T2DPointArray;
Splits the TPA to boxes with sidelength Dist and results them as a T2DPointArray
2010-09-09 11:53:07 -04:00
CombineIntArray
---------------
.. code-block:: pascal
function CombineIntArray(const Ar1, Ar2: TIntegerArray): TIntegerArray;
Attaches the TIntegerArray Ar2 onto the end of Ar1 and returns it as the result
2010-09-09 11:53:07 -04:00
MergeATPA
---------
.. code-block:: pascal
function MergeATPA(const ATPA : T2DPointArray) : TPointArray;
Combines all the TPointArrays from the T2DPointArray ATPA into the result
2010-09-09 11:53:07 -04:00
AppendTPA
---------
.. code-block:: pascal
procedure AppendTPA(var TPA: TPointArray; const ToAppend: TPointArray);
Attaches the TPointArray ToAppend onto the end of TPA
2010-09-09 11:53:07 -04:00
TPAFromBox
----------
.. code-block:: pascal
function TPAFromBox(const Box : TBox) : TPointArray;
Create a TPointArray from the top left and the bottom right of the TBox Box
2010-09-09 11:53:07 -04:00
RotatePoints
------------
.. code-block:: pascal
function RotatePoints(Const P: TPointArray; A, cx, cy: Extended): TPointArray ;
Rotates the TPointArray P around the center cx, cy with the angle a
2010-09-09 11:53:07 -04:00
FindTPAEdges
------------
.. code-block:: pascal
function FindTPAEdges(const p: TPointArray): TPointArray;
Returns a TPointArray of the edge points of the TPointArray p
2010-09-09 11:53:07 -04:00
ClearTPAFromTPA
---------------
.. code-block:: pascal
function ClearTPAFromTPA(const arP, ClearPoints: TPointArray): TPointArray;
Removes the points in TPointArray ClearPoints from arP
2010-09-09 11:53:07 -04:00
ReturnPointsNotInTPA
--------------------
.. code-block:: pascal
function ReturnPointsNotInTPA(Const TotalTPA: TPointArray; const Box: TBox): TPointArray;
All the points from the TPointArray TotalTPA that are not in the TBox Box are returned in the TPointArray Res
2010-09-09 11:53:07 -04:00
PointInTPA
----------
.. code-block:: pascal
function PointInTPA(p: TPoint;const arP: TPointArray): Boolean;
Returns true if the TPoint p is found in the TPointArray arP
2010-09-09 11:53:07 -04:00
ClearDoubleTPA
--------------
.. code-block:: pascal
procedure ClearDoubleTPA(var TPA: TPointArray);
Deletes duplicate TPAs int he TPointArray TPA
2010-09-09 11:53:07 -04:00
TPACountSort
------------
.. code-block:: pascal
procedure TPACountSort(Var TPA: TPointArray;const max: TPoint;Const SortOnX : Boolean);
TPACountSortBase
----------------
.. code-block:: pascal
procedure TPACountSortBase(Var TPA: TPointArray;const maxx, base: TPoint; const SortOnX : Boolean);
InvertTIA
---------
.. code-block:: pascal
procedure InvertTIA(var tI: TIntegerArray);
Reverses the TIntegerArray tI
2010-09-09 11:53:07 -04:00
SumIntegerArray
---------------
.. code-block:: pascal
function SumIntegerArray(const Ints : TIntegerArray): Integer;
Retuns the sum of all the integers in the TIntegerArray Ints
2010-09-09 11:53:07 -04:00
AverageTIA
----------
.. code-block:: pascal
function AverageTIA(const tI: TIntegerArray): Integer;
Gives an average of the sum of the integers in the TIntegerArray tI
2010-09-09 11:53:07 -04:00
AverageExtended
---------------
.. code-block:: pascal
function AverageExtended(const tE: TExtendedArray): Extended;
Gives an average of the sum of the extendeds in the TExtendedArray tI
2010-09-09 11:53:07 -04:00
SplitTPAExWrap
--------------
.. code-block:: pascal
procedure SplitTPAExWrap(const arr: TPointArray; w, h: Integer; var res : T2DPointArray);
Splits the points with max X and Y distances W and H to their and returns the result in the T2DPointArray Res
2010-09-09 11:53:07 -04:00
SplitTPAWrap
------------
.. code-block:: pascal
procedure SplitTPAWrap(const arr: TPointArray; Dist: Integer; var res: T2DPointArray);
Splits the points with max distance Dist to their own TPointArrays and returns the result in the T2DPointArray Res
2010-09-09 11:53:07 -04:00
FindGapsTPAWrap
---------------
.. code-block:: pascal
procedure FindGapsTPAWrap(const TPA: TPointArray; MinPixels: Integer; var Res : T2DPointArray);
Finds the possible gaps in the TPointArray TPA and the result is returned in the T2DPointArray Res. Considers as a gap if the gap length is >= MinPixels
2010-09-09 11:53:07 -04:00
RemoveDistTPointArrayWrap
-------------------------
.. code-block:: pascal
procedure RemoveDistTPointArrayWrap(x, y, dist: Integer;const ThePoints: TPointArray; RemoveHigher: Boolean; var Res : TPointArray);
Finds the possible gaps in the TPointArray TPA and removes the gaps. Considers as a gap if the gap length is >= MinPixels and returns the result in the TPointArray Res
2010-09-09 11:53:07 -04:00
CombineTPAWrap
--------------
.. code-block:: pascal
procedure CombineTPAWrap(const Ar1, Ar2: TPointArray; var Res : TPointArray);
Attaches the TPointArray Ar2 onto the end of Ar1 and returns the result in the TPointArray Res
2010-09-09 11:53:07 -04:00
ReArrangeandShortenArrayExWrap
------------------------------
.. code-block:: pascal
procedure ReArrangeandShortenArrayExWrap(const a: TPointArray; w, h: Integer; var Res : TPointArray);
Results the TPointArray a with one point per box with side lengths W and H left and puts the result in Res
2010-09-09 11:53:07 -04:00
ReArrangeandShortenArrayWrap
----------------------------
.. code-block:: pascal
procedure ReArrangeandShortenArrayWrap(const a: TPointArray; Dist: Integer; var Res : TPointArray);
Results the TPointArray a with one point per box with side length Dist left and puts the result in Res
2010-09-09 11:53:07 -04:00
TPAtoATPAExWrap
---------------
.. code-block:: pascal
procedure TPAtoATPAExWrap(const TPA: TPointArray; w, h: Integer; var Res : T2DPointArray);
Splits the TPA to boxes with sidelengths W and H and results them as a T2DPointArray in Res
2010-09-09 11:53:07 -04:00
TPAtoATPAWrap
-------------
.. code-block:: pascal
procedure TPAtoATPAWrap(const TPA: TPointArray; Dist: Integer; var Res : T2DPointArray);
Splits the TPA to boxes with sidelength Dist and results them as a T2DPointArray in Res
2010-09-09 11:53:07 -04:00
CombineIntArrayWrap
-------------------
.. code-block:: pascal
procedure CombineIntArrayWrap(const Ar1, Ar2: TIntegerArray; var Res : TIntegerArray);
Attaches the TIntegerArray Ar2 onto the end of Ar1 and returns it in the TIntegerArray Res
2010-09-09 11:53:07 -04:00
ReturnPointsNotInTPAWrap
------------------------
.. code-block:: pascal
procedure ReturnPointsNotInTPAWrap(Const TotalTPA: TPointArray; const Box: TBox; var Res : TPointArray);
All the points from the TPointArray TotalTPA that are not in the TBox Box are returned in the TPointArray Res
2010-09-09 11:53:07 -04:00
MergeATPAWrap
-------------
.. code-block:: pascal
procedure MergeATPAWrap(const ATPA : T2DPointArray; var Res: TPointArray);
Combines all the TPointArrays from the T2DPointArray ATPA into the TPointArray Res
2010-09-09 11:53:07 -04:00
TPAFromBoxWrap
--------------
.. code-block:: pascal
procedure TPAFromBoxWrap(const Box : TBox; var Res : TPointArray);
Create a TPointArray from the top left and the bottom right of the TBox Box and returns the result in Res
2010-09-09 11:53:07 -04:00
RotatePointsWrap
----------------
.. code-block:: pascal
procedure RotatePointsWrap(Const P: TPointArray; A, cx, cy: Extended; var Res : TPointArray);
Rotates the TPointArray P around the center cx, cy with the angle a and returns the result in Res
2010-09-09 11:53:07 -04:00
FindTPAEdgesWrap
----------------
.. code-block:: pascal
procedure FindTPAEdgesWrap(const p: TPointArray; var Res : TPointArray);
Returns a TPointArray of the edge points of the TPointArray p and returns the result in the TPointArray Res
2010-09-09 11:53:07 -04:00
ClearTPAFromTPAWrap
-------------------
.. code-block:: pascal
procedure ClearTPAFromTPAWrap(const arP, ClearPoints: TPointArray; var Res : TPointArray);
Removes the points in TPointArray ClearPoints from arP and returns the results in Res
2010-09-09 11:53:07 -04:00
SameTPA
-------
.. code-block:: pascal
function SameTPA(const aTPA, bTPA: TPointArray): Boolean;
Returns true if the TPointArray aTPA is the same as bTPA
2010-09-09 11:53:07 -04:00
TPAInATPA
---------
.. code-block:: pascal
function TPAInATPA(const TPA: TPointArray;const InATPA: T2DPointArray; var Index: LongInt): Boolean;
Returns true if the TPointArray TPA is found in the T2DPointArray InATPA and stores the index in Index
2010-09-09 11:53:07 -04:00
OffsetTPA
---------
.. code-block:: pascal
procedure OffsetTPA(var TPA : TPointArray; const Offset : TPoint);
Offsets all the TPAs int the TPointArray TPA but the TPoint Offset
2010-09-09 11:53:07 -04:00
OffsetATPA
----------
.. code-block:: pascal
procedure OffsetATPA(var ATPA : T2DPointArray; const Offset : TPoint);
Offsets all the TPAs int the T2DPointArray ATPA but the TPoint Offset
2010-09-09 11:53:07 -04:00
CopyTPA
-------
.. code-block:: pascal
function CopyTPA(const TPA : TPointArray) : TPointArray;
Returns the TPointArray TPA
2010-09-09 11:53:07 -04:00
CopyATPA
--------
.. code-block:: pascal
function CopyATPA(const ATPA : T2DPointArray) : T2DPointArray;
Returns the T2DPointArray ATPA
2010-09-09 11:53:07 -04:00