SortTPA

From SCAR Divi Manual
Revision as of 23:01, 20 November 2012 by Freddy (talk | contribs)
Jump to: navigation, search

Definition

procedure SortTPA(var TPA: TPointArray);

Availability

SCAR Divi 3.28 > Current

Aliases

  • TPASort (SCAR Divi 3.26 > 3.36)

Description

Sorts a given TPointArray TPA by distance from the origin (0, 0) using the fast ShellSort algorithm. An extended function with additional functionality is available as SortTPAEx.

Example

var
  TPA: TPointArray;

begin
  TPA := [Point(2, 2), Point(0, 0), Point(5, 10), Point(0, 0)];
  SortTPA(TPA);
  WriteLn(TPAToStr(TPA));
end.

Output:

(0,0);(0,0);(2,2);(5,10)

See Also