TPoint Arrays

A file that stores type functions to manipulate TPointArrays.

The source for this file can be found here.

TPointArray.copy

function TPointArray.copy(): TPointArray;

Copies a TPointArray.

Note

  • by Coh3n

Example:

newTPA := TPA.copy();

TPointArray.copy; overload

function TPointArray.copy(area: TBox): TPointArray; overload;

Copies all the points that fall within the bounds of ‘area’.

Note

  • by Olly

Example:

newTPA := TPA.copy(b);

TPointArray.addIndex

procedure TPointArray.addIndex(const p : TPoint; const index : Integer);

Used to add a point to a TPointArray at a chosen index.

Note

  • by Zyt3x

Example:

TPA.addIndex(point(13, 37), 0);

TPointArray.deleteIndex

procedure TPointArray.deleteIndex(const index : Integer);

Used to delete a point of a TPointArray at a chosen index.

Note

  • by Zyt3x

Example:

TPA.deleteIndex(0);

TPointArray.append

procedure TPointArray.append(const p : TPoint);

Used to append a point to a TPointArray.

Note

  • by Zyt3x

Example:

TPA.append(1337.0);

TPointArray.combine

procedure TPointArray.combine(const arr : TPointArray);

Used to combine two TPointArray variables.

Note

  • by Zyt3x

Example:

TPA.combine(TPA2);

TPointArray.returnPosInArray

function TPointArray.returnPosInArray(const p : TPoint) : Integer;

Returns the index of where the point was found in a TPointArray. Returns -1 if not found.

Note

  • by Zyt3x

Example:

writeLn(TPA.returnPosInArray(point(13, 37)));

TPointArray.isInArray

function TPointArray.isInArray(const p : TPoint) : Boolean;

Returns True if the point is present in the TPointArray.

Note

  • by Zyt3x

Example:

writeLn(TPA.isInArray(point(13, 37)));

TPointArray.include

function TPointArray.include(const arr : TPointArray) : TPointArray;

Returns a TPointArray which contains points that are present in both arrays.

Note

  • by Zyt3x

Example:

TPA := TPA2.include(TPA);

TPointArray.exclude

function TPointArray.exclude(const arr : TPointArray) : TPointArray;

Returns a TPointArray which contains points that are not present in both arrays.

Note

  • by Zyt3x

Example:

TPA := TPA2.exclude(TEA);

TPointArray.rotate

procedure TPointArray.rotate(const angle, cx, cy: extended);

Rotates the points in the TPointArray.

Note

  • by Ollybest

Example:

tpa.rotate(40.00, p.x, p.y);

TPointArray.clearEquals

procedure TPointArray.clearEquals();

Used to clear duplicates in a TPointArray.

Note

  • by Ollybest

Example:

TPA.clearEquals();

TPointArray.invert

procedure TPointArray.invert();

Used to invert the TPointArray.

Note

  • by Zyt3x

Example:

TPA.invert();

TPointArray.getMiddle

function TPointArray.getMiddle(): TPoint;

Returns the point in the average middle of the TPA.

Note

  • by Zyt3x

Example:

mP := TPA.getMiddle();

TPointArray.getBounds

function TPointArray.getBounds() : TPoint;

Returns the box boundaries of the TPA.

Note

  • by Zyt3x

Example:

b := TPA.getBounds();

TPointArray.getDensity

function TPointArray.getDensity(): extended;

Returns the density of the TPointArray.

Note

  • by Ollybest

Example:

writeln(tpa.getDensity());

TPointArray.equals

function TPointArray.equal() : Boolean;

Returns true if both TPointArrays are equal.

Note

  • by Zyt3x

Example:

b := TPA.equals(TPA2);

TPointArray.isPointNear

function TPointArray.isPointNear(const P : TPoint; const W, H : Integer): Boolean;

Returns True if the point is near the array.

Note

  • by Zyt3x

Example:

TPA.isPointNear(P, 13, 37);

TPointArray.isPointNear: overload;

function TPointArray.isPointNear(const P : TPoint; const D : Integer): Boolean; overload;

Returns True if the point is near the array.

Note

  • by Zyt3x

Example:

TPA.isPointNear(P, 1337);

TPointArray.returnInTPA

function TPointArray.returnInTPA(const arr : TPointArray) : TPointArray);

Returns the TPA where the points in arr matches the points in the TPointArray.

Note

  • by Zyt3x

Example:

..code-block:: pascal

matches := TPA.returnInTPA(TPA2);

TPointArray.returnInTPA; overload;

function TPointArray.returnInTPA(const arr : TPointArray; var matches : TPointArray) : Boolean; overload;
Returns True if the TPA where the points in arr matches the points in the TPointArray.
Also returns the matching points in the TPA “matches”

Note

  • by Zyt3x

Example:

..code-block:: pascal

if TPA.returnInTPA(TPA2, resultTPA) then

TPointArray.returnNotInTPA

function TPointArray.returnNotInTPA(b: TBox): TPointArray;

Returns the points in the given box (b) that are not in the TPointArray.

Note

  • by Coh3n

Example:

..code-block:: pascal

if (TPA.returnNotInTPA(b)) then

TPointArray.offset

procedure TPointArray.offset(p: TPoint);

Offsets each point in the TPointArray by the point p.

Note

  • by Coh3n

Example:

..code-block:: pascal

TPA.offset(point(5, 5));

TPointArray.sortQuick

procedure TPointArray.sortQuick(const arr : TIntegerArray; const iLo, iHi : Integer; const sortUp : Boolean);

Used to QuickSort the TPointArray. PS: Using the TIntegerArray arr to sort.

Note

  • by Zyt3x

Example:

TPA.sortQuick(13, 37, True);

TPointArray.sortByXValue

procedure TPointArray.sortByXValue(const lowToHigh : Boolean);

Sorts the TPA from lowest X to highest X or highest X to lowest X, depending on lowToHigh

Note

  • by Zyt3x

Example:

TPA.sortByXValue(True);

TPointArray.sortByYValue

procedure TPointArray.sortByYValue(const lowToHigh : Boolean);

Sorts the TPA from lowest Y to highest Y or highest Y to lowest Y, depending on lowToHigh

Note

  • by Zyt3x

Example:

TPA.sortByYValue(True);

TPointArray.sortFromPoint

procedure TPointArray.sortFromPoint(const P : TPoint);

Sorts the TPA from a point

Note

  • by Zyt3x

Example:

TPA.sortFromPoint(P);

TPointArray.filterPointsBox

procedure TPointArray.filterPointsBox(x, y, x2, y2: integer);

Removes all the points outside of the box.

Note

  • by masterBB

Example:

tpa.filterPointsBox(100, 100, 200, 200);

TPointArray.filterPointsBox; overload

procedure TPointArray.filterPointsBox(box: TBox); overload;

Accepts a TBox rather than x1, y1, x2, y2 vars.

Note

  • by Ollybest

Example:

tpa.filterPointsBox(myBox);

TPointArray.excludePointsCircle

procedure TPointArray.excludePointsCircle(const startD, endD, minRadius, maxRadius : Extended; const mX, mY : Integer);
Removes the points that are in the TPointArray Points that are not within 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. Lookup FilterPointsPie for more information.

Note

  • by Zyt3x

Example:

TPA.excludePointsCircle(13.0, 37.0, 13.0, 37.0, 13, 37);

TPointArray.excludePointsLine

procedure TPointArray.excludePointsLine(const angle : Extended; const length, mX, mY : Integer);
Removes the points in the TPointArray Points that are not on the line defined by
angle, length and center. Lookup FilterPointsLine for more information.

Note

  • by Zyt3x

Example:

TPA.excludePointsLine(13.0, 13, 33, 37);

TPointArray.excludePointsDist

procedure TPointArray.excludePointsDist(const minD, maxD : Extended; const mX, mY : Integer);
Removes the points that don’t have a dist between mindist/maxdist with (mx,my).
Lookup FilterPointsDist for more information.

Note

  • by Zyt3x

Example:

TPA.excludePointsDist(13.0, 13, 33, 37);

TPointArray.findTextIn

function TPointArray.findTextIn(const height : Integer; const searchTPA : TPointArray; var matches : TPointArray): Boolean;

Returns True if the text TPA is found within TPointArray. Also returns the matching points in the variable matches.

Note

  • by Zyt3x

Example:

TPA.findTextIn(13.0, sTPA, mTPA);

TPointArray.split

function TPointArray.split(w, h: integer): T2DPointArray;

Splits the TPointArray into a 2D array of boxes w by h.

Note

  • by Coh3n

Example:

ATPA := TPA.split(5, 3);

TPointArray.split; overload

function TPointArray.split(const dist: integer): T2DPointArray;

Splits the TPointArray into a 2D array of boxes dist by dist.

Note

  • by Coh3n

Example:

ATPA := TPA.split(4);

TPointArray.cluster

function TPointArray.cluster(const dist: integer): T2DPointArray;

Splits the points with max distance ‘dist’ to their own TPointArrays. An alternative to SplitTPA, will be extremely fast compared to SplitTPA with a distance less than 100.

Note

  • by Olly

Example:

atpa := tpa.cluster(5);

TPointArray.cluster; overload

function TPointArray.cluster(const width, height: integer): T2DPointArray; overload;

Splits the points to their own TPointArrays if they fall outside of ‘width’ and ‘height’ bounds. An alternative to SplitTPAEx, will be extremely fast compared to SplitTPAEx with a width/height less than 100.

Note

  • by Olly

Example:

atpa := tpa.cluster(5, 5);

TPointArray.clearTPAFrom

function TPointArray.clearTPAFrom(const tpa: TPointArray): TPointArray;

Removes the points in ‘tpa’ that are in the TPointArray.

Note

  • by Coh3n

Example:

filteredTPA := TPA.clearTPAFrom(clearTPA);

TPointArray.toATPA

function TPointArray.toATPA(const distance: integer): T2DPointArray;

Splits the TPA to boxes with sidelength distance and results them as a T2DPointArray.

Note

  • by Ollybest

Example:

atpa := tpa.toATPA(10);

TPointArray.toATPA

function TPointArray.toATPA(const distance: integer): T2DPointArray; overload;

Splits the TPA to boxes with sidelengths W and H and results them as a T2DPointArray

Note

  • by Ollybest

Example:

atpa := tpa.toATPA(10, 5);

TPointArray.fill

procedure TPointArray.fill();

Fills the TPA.

Note

  • by Ollybest

Example:

tpa.fill();

TPointArray.getEdges

function TPointArray.getEdges(): TPointArray;

Returns the edges of the TPA

Note

  • by Ollybest

Example:

edgeTPA := tpa.getEdges();

T2DPointArray.sortFromMidPoint

procedure T2DPointArray.sortFromMidPoint(const sortFrom: TPoint);

Sorts the atpa from sortFrom, from the middle of each TPA.

Note

  • by Ollybest

Example:

atpa.sortFromMidPoint(point(50, 50));

T2DPointArray.getSamePoints

function T2DPointArray.getSamePoints(): TPointArray;

Returns the points that all match in the atpa.

Note

  • by Ollybest

Example:

matches := atpa.getSamePoints();

T2DPointArray.getSamePoints; overload

function T2DPointArray.getSamePoints(): integer; overload;

Returns the length of the matching points rather than the points that match.

Note

  • by Ollybest

Example:

len := atpa.getSamePoints();

T2DPointArray.getEachBounds

function T2DPointArray.getEachBounds(): TBoxArray;

Returns each TPA bounds in the atpa in a TBoxArray.

Note

  • by Ollybest

Example:

boxArr := atpa.getEachBounds();

T2DPointArray.merge

function T2DPointArray.merge(): TPointArray;

Merges the T2DPointArray into a TPointArray.

Note

  • by Coh3n

Example:

TPA := ATPA.merge();

T2DPointArray.getBounds

function T2DPointArray.getBounds(): TBox;

Returns the box boundaries of the TPA.

Note

  • by Coh3n

Example:

b := TPA.getBounds();

T2DPointArray.offset

procedure T2DPointArray.offset(p: TPoint);

Offsets a T2DPointArray by p.

Note

  • by Coh3n

Example:

atpa.offset(point(1, 1));

T2DPointArray.copy

function T2DPointArray.copy(): T2DPointArray;

Copies a T2DPointArray.

Note

  • by Coh3n

Example:

newATPA := ATPA.copy();

T2DPointArray.merge

function T2DPointArray.getTextATPA(const maxSpacing: integer; const font: string): string;

Returns the string of font found inthe T2DPointArray.

Note

  • by Coh3n

Example:

txt := ATPA.getTextATPA();

T2DPointArray.sortFromFirstPoint

procedure T2DPointArray.sortFromFirstPoint(const sortFrom: TPoint);

Sorts the atpa from the desired TPoint.

Note

  • by Ollybest

Example:

atpa.sortFromFirstPoint(point(250, 250));

T2DPointArray.sortBySize

procedure T2DPointArray.sortBySize(const largestFirst: boolean = true);

Sorts the ATPA from smallest or largest based on the largestFirst boolean.

  • Parameter largestFirst is optional (defualt set to true).

Note

  • by Ollybest

Example:

atpa.sortSize;

T2DPointArray.sortFromSize

procedure T2DPointArray.sortFromSize(const fromSize: integer; const closestFirst: boolean);

Sorts the T2DPointArray from size by the closest first if closestFirst is true.

Note

  • by Ollybest

Example:

atpa.sortFromSize(400, true);

T2DPointArray.filterBetween

procedure T2DPointArray.filterBetween(const min, max: integer);

Removes the tpas in the atpa if they their length is between min and max.

Note

  • by Ollybest

Example:

atpa.filterBetween(0, 50);

T2DPointArray.deleteIndex

procedure TPointArray.deleteIndex(const index: Integer);

Used to delete a TPointArray of a T2DPointArray at a chosen index. Made from TPointArray.deleteIndex

Note

  • by TomTuff

Example:

ATPA.deleteIndex(0);

TPointArray.getConvexHull

procedure TPointArray.getConvexHull(out tpa: TPointArray);

Returns the Convex Hull of the TPointArray.

Note

  • by slacky.
  • Last Updated: 13 September 2015 by slacky.

Example:

tpa.getCovexHull(pnts);