TPAMean

From SCAR Divi Manual
Revision as of 19:00, 22 November 2012 by Freddy (talk | contribs) (Created page with "==Definition== <source lang="scar" lines="false"> function TPAMean(const TPA: TPointArray): TPoint; </source> ==Availability== SCAR Divi 3.28 > Current ===Aliases=== *Middle...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Definition

function TPAMean(const TPA: TPointArray): TPoint;

Availability

SCAR Divi 3.28 > Current

Aliases

  • MiddleTPA (SCAR Divi 3.20 > 3.35)
  • TPAMiddle (SCAR Divi 3.26 > 3.37)

Description

This function determines the arithmetic mean of all x and y coordinates in the given TPointArray TPA, and returns this as a TPoint (rounded down).

Example

var
  TPA: TPointArray;
  MeanPoint: TPoint;
  
begin
  TPA := [Point(0, 0), Point(2, 2), Point(5, 10)];
  MeanPoint := TPAMean(TPA);
  WriteLn(PointToStr(MeanPoint));
end.

Output:

(2,4)

See Also