Difference between revisions of "TPAMiddle"

From SCAR Divi Manual
Jump to: navigation, search
(Example)
Line 5: Line 5:
  
 
==Availability==
 
==Availability==
SCAR Divi 3.20 > Current
+
SCAR Divi 3.26 > Current
 +
 
 +
===Aliases===
 +
*MiddleTPA (SCAR Divi 3.20 > Current)
  
 
==Description==
 
==Description==
 
This function determines the center point of a given [[TPointArray]] '''TPA''' by calculating the averages of the x and y coordinates. An extended function with additional functionality is available as TPAMiddleEx.
 
This function determines the center point of a given [[TPointArray]] '''TPA''' by calculating the averages of the x and y coordinates. An extended function with additional functionality is available as TPAMiddleEx.
 
==Aliases==
 
*MiddleTPA
 
  
 
==Example==
 
==Example==

Revision as of 00:48, 27 June 2011

Definition

function TPAMiddle(const TPA: TPointArray): TPoint;

Availability

SCAR Divi 3.26 > Current

Aliases

  • MiddleTPA (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. An extended function with additional functionality is available as TPAMiddleEx.

Example

var
  TPA: TPointArray;
  MiddlePoint: TPoint;
  
begin
  TPA := [Point(0, 0), Point(2, 2), Point(5, 10)];
  MiddlePoint := TPAMiddle(TPA);
  WriteLn('Middle-Point(' + IntToStr(MiddlePoint.x) + ',' + IntToStr(MiddlePoint.y) + ')');
end.

Output:

Middle-Point(2,4)

See Also