Difference between revisions of "SortTPASpiral"
From SCAR Divi Manual
(Created page with "==Definition== <source lang="scar" lines="false"> procedure SortTPASpiral(var TPA: TPointArray); </source> ==Availability== SCAR Divi 3.38 > Current ==Description== Sorts a ...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | [[File:SpiralFormat.png|thumb|right|The default spiral format is defined as moving in the sequential directions "up, right, down, left" on a bitmap image. This translates to "-y, x, y, -x" in coordinates.]] | ||
+ | |||
==Definition== | ==Definition== | ||
<source lang="scar" lines="false"> | <source lang="scar" lines="false"> | ||
Line 27: | Line 29: | ||
==See Also== | ==See Also== | ||
*[[SortTPASpiralEx]] | *[[SortTPASpiralEx]] | ||
− | *[[ | + | *[[SortTPA]] |
[[Category:Functions]] | [[Category:Functions]] | ||
[[Category:TPA Functions]] | [[Category:TPA Functions]] | ||
[[Category:Array Functions]] | [[Category:Array Functions]] |
Latest revision as of 16:13, 25 November 2012
Definition
procedure SortTPASpiral(var TPA: TPointArray);
Availability
SCAR Divi 3.38 > Current
Description
Sorts a given TPointArray TPA in a spiral pattern, spiraling out from the origin (0, 0) using the fast ShellSort algorithm. An extended function with additional functionality is available as SortTPASpiralEx.
Example
var TPA: TPointArray; begin TPA := TPAFromBox(Box(-1, -1, 1, 1)); SortTPASpiral(TPA); WriteLn(TPAToStr(TPA)); end.
Output:
(0,0);(0,-1);(1,-1);(1,0);(1,1);(0,1);(-1,1);(-1,0);(-1,-1)