Difference between revisions of "TPABounds"
From SCAR Divi Manual
(3 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
==Availability== | ==Availability== | ||
SCAR Divi 3.26 > Current | SCAR Divi 3.26 > Current | ||
+ | |||
+ | ===Aliases=== | ||
+ | *GetTPABounds (SCAR Divi 3.20 > 3.35) | ||
==Description== | ==Description== | ||
This function calculates the bounds of a given [[TPointArray]] '''TPA''' by searching the most outer coordinates of a box which can contain all of the points and returns that box as a [[TBox]]. | This function calculates the bounds of a given [[TPointArray]] '''TPA''' by searching the most outer coordinates of a box which can contain all of the points and returns that box as a [[TBox]]. | ||
− | |||
− | |||
− | |||
==Example== | ==Example== | ||
Line 21: | Line 21: | ||
begin | begin | ||
TPA := [Point(0, 0), Point(2, 2), Point(5, 10)]; | TPA := [Point(0, 0), Point(2, 2), Point(5, 10)]; | ||
− | Box := | + | Box := TPABounds(TPA); |
WriteLn('Box(' + IntToStr(Box.x1) + ',' + IntToStr(Box.y1) + ',' + | WriteLn('Box(' + IntToStr(Box.x1) + ',' + IntToStr(Box.y1) + ',' + | ||
IntToStr(Box.x2) + ',' + IntToStr(Box.y2) + ')'); | IntToStr(Box.x2) + ',' + IntToStr(Box.y2) + ')'); | ||
Line 37: | Line 37: | ||
[[Category:Functions]] | [[Category:Functions]] | ||
[[Category:TPA Functions]] | [[Category:TPA Functions]] | ||
+ | [[Category:Array Functions]] |
Latest revision as of 11:52, 14 July 2012
Definition
function TPABounds(const TPA: TPointArray): TBox;
Availability
SCAR Divi 3.26 > Current
Aliases
- GetTPABounds (SCAR Divi 3.20 > 3.35)
Description
This function calculates the bounds of a given TPointArray TPA by searching the most outer coordinates of a box which can contain all of the points and returns that box as a TBox.
Example
var TPA: TPointArray; Box: TBox; begin TPA := [Point(0, 0), Point(2, 2), Point(5, 10)]; Box := TPABounds(TPA); WriteLn('Box(' + IntToStr(Box.x1) + ',' + IntToStr(Box.y1) + ',' + IntToStr(Box.x2) + ',' + IntToStr(Box.y2) + ')'); end.
Output:
Box(0,0,5,10)