TPAMean

From SCAR Divi Manual
(Redirected from TPAMiddle)
Jump to: navigation, search

Definition

function TPAMean(const TPA: TPointArray): TPoint;

Availability

SCAR Divi 3.38 > 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