Difference between revisions of "TPAMiddle"
From SCAR Divi Manual
(→Availability) |
|||
Line 11: | Line 11: | ||
==Description== | ==Description== | ||
− | This function determines the | + | 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). An extended function with additional functionality is available as [[TPAMiddleEx]]. |
==Example== | ==Example== |
Revision as of 15:18, 22 November 2012
Definition
function TPAMiddle(const TPA: TPointArray): TPoint;
Availability
SCAR Divi 3.26 > Current
Aliases
- MiddleTPA (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 this as a TPoint (rounded down). 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)