Results 1 to 33 of 33

Thread: [2.0] Efficient Matching

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2004
    Posts
    185

    [2.0] Efficient Matching

    This may be more of a general programming question, but here goes:

    I have three arrays (could be more, though, in the future) of points. Each point has an X, Y, Z associated with it.

    There are as many as 136400 Points in these arrays but could be more in the future. I have them designated as Lists, actually, Lists of my custom class Point.

    What I want to do, is remove any redundant Points in the Lists (Points that have the *same* X, Y, Z coordinates as each other). Within a limit anyway, say if the Xs, Ys, and Zs are all within +/- 0.5 of each other.

    To do it, I have it set up with a few nested for loops.

    The first outer loop loops List1, and inside of this outer loop, List2 is looped to check for matches with the current point we're looking for in List1 (List1[i]), and then does the same with another inner loop which checks List3 for matches with the current List1[i] Point.. If the points are the same as the current point being examined (List1[i]) then the point is removed from List2 or List3 (wherever it was found).

    It then outer loops List2, with an inner loop looking for matches with List3.

    This process makes takes FOREVER. I calculated it out to be around 58 billion loops through, and takes sooo long.

    Is there a more efficient or better way to look for matches? I can type the code out if it helps anyone, I was just thinking that this has to be sort of common and you probably can guess/understand the way I'm attempting it.

    It is currently on it's own thread and everything, it just takes a very long time to do all the loops (~20 minutes with the numbers I listed).
    Last edited by pjrage; Jan 29th, 2008 at 02:18 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width