Results 1 to 3 of 3

Thread: SortATPAFrom doesn't work /or/ how to use it?

  1. #1
    Join Date
    Oct 2011
    Posts
    805
    Mentioned
    21 Post(s)
    Quoted
    152 Post(s)

    Default SortATPAFrom doesn't work /or/ how to use it?

    Quote Originally Posted by http://docs.wizzup.org
    SortATPAFrom

    procedure SortATPAFrom(var a: T2DPointArray; const From: TPoint);

    Sorts the T2DPointArray a from the TPoint From
    Simba Code:
    program new;
    var ATPA :T2dPointarray;
    begin
    setlength(ATPA,5);
    ATPA[0] := [Point(0,0)];
    ATPA[1] := [Point(300,300)];
    ATPA[2] := [Point(999,999)];
    ATPA[3] := [Point(299,299)];
    ATPA[4] := [Point(301,302)];

    SortATPAFrom(ATPA ,Point(300,300));
    writeln(ATPA);

    end.

    Code:
    Compiled successfully in 16 ms.
    [[(0, 0)], [(300, 300)], [(999, 999)], [(299, 299)], [(301, 302)]]
    Successfully executed.
    So it does nothing. Any suggestion?

  2. #2
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    It sorts each array from the closest to the furthest from the point - since all your arrays only have one point, it's already sorted. You need to add more points into the individual arrays for it to actually change the order around.
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  3. #3
    Join Date
    Oct 2011
    Posts
    805
    Mentioned
    21 Post(s)
    Quoted
    152 Post(s)

    Default

    Ok ,I thought it sorts ATPA ,not TPoints in TPAs.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •