Difference between revisions of "SortATPABySize"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> procedure SortATPABySize(var ATPA: T2DPointArray); </source> ==Availability== SCAR Divi 3.28 > Current ===Aliases=== *ATPASort...")
 
 
(4 intermediate revisions by the same user not shown)
Line 8: Line 8:
  
 
===Aliases===
 
===Aliases===
*ATPASortBySize (SCAR Divi 3.26 > Current)
+
*ATPASortBySize (SCAR Divi 3.26 > 3.35)
  
 
==Description==
 
==Description==
Sorts the [[TPointArray|TPointArrays]] in the given [[T2DPointArray]] '''ATPA''' by their respective lengths.
+
Sorts the [[TPointArray|TPointArrays]] in the given [[T2DPointArray]] '''ATPA''' by their respective lengths using the fast [http://en.wikipedia.org/wiki/Shell_sort ShellSort] algorithm.
  
 
==Example==
 
==Example==
Line 36: Line 36:
 
  (5,6);(0,0);(1,1)
 
  (5,6);(0,0);(1,1)
 
  (5,6);(0,0);(1,1);(6,6)
 
  (5,6);(0,0);(1,1);(6,6)
 +
 +
==See Also==
 +
*[[SortATPAByMiddle]]
 +
*[[SortATPAByMiddleEx]]
 +
*[[SortATPAByFirst]]
 +
*[[SortATPAByFirstEx]]
  
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:TPA Functions]]
 
[[Category:TPA Functions]]
 
[[Category:Array Functions]]
 
[[Category:Array Functions]]

Latest revision as of 11:56, 14 July 2012

Definition

procedure SortATPABySize(var ATPA: T2DPointArray);

Availability

SCAR Divi 3.28 > Current

Aliases

  • ATPASortBySize (SCAR Divi 3.26 > 3.35)

Description

Sorts the TPointArrays in the given T2DPointArray ATPA by their respective lengths using the fast ShellSort algorithm.

Example

var
  ATPA: T2DPointArray;
  i: Integer;

begin
  SetLength(ATPA, 4);
  ATPA[0] := [Point(5, 6), Point(0, 0), Point(1, 1), Point(6, 6)];
  ATPA[1] := [Point(5, 6)];
  ATPA[2] := [Point(5, 6), Point(0, 0), Point(1, 1)];
  ATPA[3] := [Point(5, 6), Point(0, 0)];
  SortATPABySize(ATPA);
  for i := 0 to High(ATPA) do
    WriteLn(TPAToStr(ATPA[i]));
end.

Output:

(5,6)
(5,6);(0,0)
(5,6);(0,0);(1,1)
(5,6);(0,0);(1,1);(6,6)

See Also