TPAMiddleEx

From SCAR Divi Manual
Revision as of 10:37, 3 September 2011 by Freddy (talk | contribs) (Created page with "==Definition== <source lang="scar" lines="false"> function TPAMiddle(const TPA: TPointArray; out x, y: Integer): Boolean; </source> ==Availability== SCAR Divi 3.26 > Current ==...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Definition

function TPAMiddle(const TPA: TPointArray; out x, y: Integer): Boolean;

Availability

SCAR Divi 3.26 > Current

Aliases

  • MiddleTPAEx (SCAR Divi 3.20 > Current)

Description

This function determines the center point of a given TPointArray TPA by calculating the averages of the x and y coordinates and returns them in x and y. The function returns true if the given TPointArray TPA contains 1 or more values.

Example

var
  TPA: TPointArray;
  x, y: Integer;
  
begin
  TPA := [Point(0, 0), Point(2, 2), Point(5, 10)];
  if TPAMiddleEx(TPA, x, y) then
    WriteLn('Middle-Point(' + IntToStr(x) + ',' + IntToStr(y) + ')');
end.

Output:

Middle-Point(2,4)

See Also