Locating Nearest Neighbors in space (fast)



Hi,

I'm programming in C and have two separate structure arrays holding
coordinates for points in space

typedef struct{
double x;
double y;
double z;
} Position;

Position *array1; /*Approx. 50,000 Entries*/
Position *array2; /*Approx 50,000 Entries*/

My problem is this, I want to take each point in array 1, and find its
'nearest spatial neighbor' in array 2. This can be done by brute force, but
is rather slow, since to do this requires on the order of 10^10 multiplies.
Further, I want to do this operation abot 180 times!

Does anyone know a fast algorithm to do this, preferably one that doesn't
require fancy knowledge of data structures etc since I'm not a professional
programmer. Thanks.


Karl


.



Relevant Pages

  • Re: Puppy Mastiff wants to Nip at Faces
    ... in my first college textbook on structured programming. ... they did was loop through an array to show how you could easily ... design, PIC code, and real time programming. ...
    (rec.pets.dogs.behavior)
  • Re: LISPPA
    ... > The abstract mathematical definition doesn't cope too well ... programming languages which do not allow to write bad programs, ... definition of array? ...
    (comp.lang.lisp)
  • Re: How do i change numerics into binary numbers?
    ... my first time trying out on programming. ... how do I extract the output from the user to make it an array? ... Those are needed details. ... what you expect for input, (even if you know that it may be garbage, you have ...
    (microsoft.public.vb.general.discussion)
  • Re: Bug/Gross InEfficiency in HeathFields fgetline program
    ... Maybe this is true in the sort of programming you do, ... you are storing a list of amounts of money as integers. ... int average ... the array, rounded towards zero. ...
    (comp.lang.c)
  • Re: Puppy Mastiff wants to Nip at Faces
    ... in my first college textbook on structured programming. ... they did was loop through an array to show how you could easily access ...   and improve your crack pot licensing fee calculator. ...
    (rec.pets.dogs.behavior)