Difference between revisions of "TPAMiddleEx"

From SCAR Divi Manual
Jump to: navigation, search
(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 ==...")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
==Definition==
 
==Definition==
 
<source lang="scar" lines="false">
 
<source lang="scar" lines="false">
function TPAMiddle(const TPA: TPointArray; out x, y: Integer): Boolean;
+
function TPAMiddleEx(const TPA: TPointArray; out x, y: Integer): Boolean;
 
</source>
 
</source>
  
 
==Availability==
 
==Availability==
SCAR Divi 3.26 > Current
+
SCAR Divi 3.26 > 3.37
  
 
===Aliases===
 
===Aliases===
*MiddleTPAEx (SCAR Divi 3.20 > Current)
+
*MiddleTPAEx (SCAR Divi 3.20 > 3.35)
  
 
==Description==
 
==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.
+
This function determines the arithmetic mean of all x and y coordinates in the given [[TPointArray]] '''TPA''' and returns them in '''x''' and '''y'''. The function returns [[true]] if the given TPointArray '''TPA''' contains 1 or more values.
  
 
==Example==
 
==Example==
Line 35: Line 35:
 
*[[TPADensity]]
 
*[[TPADensity]]
  
[[Category:Functions]]
+
[[Category:Deprecated Functions]]
[[Category:TPA Functions]]
 
[[Category:Array Functions]]
 

Latest revision as of 17:58, 22 November 2012

Definition

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

Availability

SCAR Divi 3.26 > 3.37

Aliases

  • MiddleTPAEx (SCAR Divi 3.20 > 3.35)

Description

This function determines the arithmetic mean of all x and y coordinates in the given TPointArray TPA 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