Difference between revisions of "SortTPASpiralEx"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "[[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 "...")
 
 
(2 intermediate revisions by the same user not shown)
Line 10: Line 10:
  
 
==Description==
 
==Description==
Sorts a given [[TPointArray]] '''TPA''' in a spiral pattern, spiraling out from the origin given by '''Point''', using the fast [http://en.wikipedia.org/wiki/Shell_sort ShellSort] algorithm. An extended function with additional functionality is available as [[SortTPASpiralEx]].
+
Sorts a given [[TPointArray]] '''TPA''' in a spiral pattern, spiraling out from the origin given by '''Point''', using the fast [http://en.wikipedia.org/wiki/Shell_sort ShellSort] algorithm.
  
 
==Example==
 
==Example==
Line 31: Line 31:
 
==See Also==
 
==See Also==
 
*[[SortTPASpiral]]
 
*[[SortTPASpiral]]
*[[SortTPA]]
+
*[[SortTPAEx]]
  
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:TPA Functions]]
 
[[Category:TPA Functions]]
 
[[Category:Array Functions]]
 
[[Category:Array Functions]]

Latest revision as of 17:52, 25 November 2012

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

procedure SortTPASpiralEx(var TPA: TPointArray; const Point: TPoint);

Availability

SCAR Divi 3.38 > Current

Description

Sorts a given TPointArray TPA in a spiral pattern, spiraling out from the origin given by Point, using the fast ShellSort algorithm.

Example

var
  TPA: TPointArray;
  Pt: TPoint;
  
begin   
  TPA := TPAFromBox(Box(0, 0, 2, 2)); 
  Pt := TPACenter(TPA);
  SortTPASpiralEx(TPA, Pt);
  WriteLn(TPAToStr(TPA));              
end.

Output:

(1,1);(1,0);(2,0);(2,1);(2,2);(1,2);(0,2);(0,1);(0,0)

See Also