Results 1 to 3 of 3

Thread: TPA Comparison

  1. #1
    Join Date
    Jun 2012
    Location
    Howell, Michigan
    Posts
    1,585
    Mentioned
    34 Post(s)
    Quoted
    553 Post(s)

    Default TPA Comparison

    Is there a function to get rid of the common points in two TPA's? I know hwo to combine two, but I want to remove all the common points first. I have no idea what I could do/;

  2. #2
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    These any of use?
    Simba Code:
    function FindTPInTPARange(TPA: TPointArray; TP: TPoint; Range: Integer): Boolean;
    var I: Integer;
    begin
      for I := 0 to High(TPA) do begin
        if (PointInBox(TP, IntToBox(TPA[I].x - Range, TPA[I].y - Range, TPA[I].x + Range, TPA[I].y + Range))) then begin
          Result := True;
          exit;
        end;
      end;
      Result := False;
    end;

    function RemoveDuplicateDTMs(FoundPositions: TPointArray): TPointArray;
    var I: Integer;
    begin
      SetArrayLength(Result, 1);
      for I := 0 to High(FoundPositions) do begin
        if (not FindTPInTPARange(Result, FoundPositions[I], 25)) then begin
          Result[High(Result)] := FoundPositions[I];
          SetArrayLength(Result, (High(Result) + 1) + 1);
        end;
      end;
      SetArrayLength(Result, High(Result));
    end;
    There used to be something meaningful here.

  3. #3
    Join Date
    Jun 2012
    Location
    Howell, Michigan
    Posts
    1,585
    Mentioned
    34 Post(s)
    Quoted
    553 Post(s)

    Default

    Quote Originally Posted by Frement View Post
    These any of use?
    Simba Code:
    function FindTPInTPARange(TPA: TPointArray; TP: TPoint; Range: Integer): Boolean;
    var I: Integer;
    begin
      for I := 0 to High(TPA) do begin
        if (PointInBox(TP, IntToBox(TPA[I].x - Range, TPA[I].y - Range, TPA[I].x + Range, TPA[I].y + Range))) then begin
          Result := True;
          exit;
        end;
      end;
      Result := False;
    end;

    function RemoveDuplicateDTMs(FoundPositions: TPointArray): TPointArray;
    var I: Integer;
    begin
      SetArrayLength(Result, 1);
      for I := 0 to High(FoundPositions) do begin
        if (not FindTPInTPARange(Result, FoundPositions[I], 25)) then begin
          Result[High(Result)] := FoundPositions[I];
          SetArrayLength(Result, (High(Result) + 1) + 1);
        end;
      end;
      SetArrayLength(Result, High(Result));
    end;
    Between you n' Olly in Skype I got it! thanks <3

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
  •