Difference between revisions of "TPAMean"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function TPAMean(const TPA: TPointArray): TPoint; </source> ==Availability== SCAR Divi 3.28 > Current ===Aliases=== *Middle...")
 
 
Line 5: Line 5:
  
 
==Availability==
 
==Availability==
SCAR Divi 3.28 > Current
+
SCAR Divi 3.38 > Current
  
 
===Aliases===
 
===Aliases===

Latest revision as of 18:00, 22 November 2012

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