TPACenter

From SCAR Divi Manual
Jump to: navigation, search

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)