Re: Locating Nearest Neighbors in space (fast)
- From: "William" <Reply@xxxxxxxxxxxxxxxx>
- Date: Fri, 9 Sep 2005 10:32:02 -0500
"KRK" <karlk@xxxxxxxxxxx> wrote in message
news:dfps46$585$1@xxxxxxxxxxxxxxxxxxxxxxxx
> 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.
This is essentially the "nearest color match" problem found in a
lot of graphics work. (Usually when going from a large color space
to a smaller one.) You can probably find some useful tips by
googling for things like "nearest color fast algorithm" (without
quotes) etc. In a lot of graphics work, speed is important, so
I'm thinking there's probably a lot of optimised stuff out there.
In graphics, there are other considerations than simple distance
in the color cube because the eye doesn't treat each color
channel equally. This usually involves weighting coefficients on
each index but it should be simple to modify most algorithms to
remove those. -Wm
.
- References:
- Prev by Date: Re: Locating Nearest Neighbors in space (fast)
- Next by Date: Re: Storing 20 million randomly accessible documents in compressed form
- Previous by thread: Re: Locating Nearest Neighbors in space (fast)
- Next by thread: Re: Locating Nearest Neighbors in space (fast)
- Index(es):