Difference between revisions of "TPACenter"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> unction TPACenter(const TPA: TPointArray): TPoint; </source> ==Availability== SCAR Divi 3.33 > Current ==Description== Returns...")
 
 
Line 1: Line 1:
 
==Definition==
 
==Definition==
 
<source lang="scar" lines="false">
 
<source lang="scar" lines="false">
unction TPACenter(const TPA: TPointArray): TPoint;
+
function TPACenter(const TPA: TPointArray): TPoint;
 
</source>
 
</source>
  

Latest revision as of 17:33, 19 April 2012

Definition

function TPACenter(const TPA: TPointArray): TPoint;

Availability

SCAR Divi 3.33 > Current

Description

Returns the coordinate at the center of the box that encloses all points inside of the given TPointArray TPA. The function rounds down if one or both of the dimensions of the enclosing box are even.

Example

var
  TPA: TPointArray;   
  P: TPoint;
  
begin
  TPA := [Point(0, 0), Point(2, 2), Point(2, 4)];                 
  P := TPACenter(TPA);
  WriteLn(TPAToStr([P]));
end.

Output:

(1,2)