comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Nearest Neighbor ... again!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Nearest Neighbor ... again! [message #71629 is a reply to message #71627] Thu, 08 July 2010 09:06 Go to previous messageGo to previous message
jeanh is currently offline  jeanh
Messages: 79
Registered: November 2009
Member
> The stupid solution is (sorry for the very very ugly code):
>
> ---
> for i = 0l, n2 - 1 do begin
> quad = (x2[i] - x1)^2 + (y2[i]- y1)^2
> for j=0, 3 do begin
> minquad = min(quad, p)
> if N_ELEMENTS(p) gt 1 then p = p[0] ; it happens.....
> out[j,i] = p
> quad[p] = max(quad) * 2. ;dummy large distance
> endfor
> endfor
> ---
>
> But I just cannot find a cleverer solution with triangulation...
> Someone clever than me to help ?
>
> Thanks a lot!
>
> Fabz

While there is certainly a better solution, you can start by removing
the j loop, and use sort(quad) instead of min() ... you can then take
the first 4 index.
Jean
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Sale HAMILTON watches(www.nike-black.com)
Next Topic: diffusion list on GDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 10:09:56 PDT 2025

Total time taken to generate the page: 1.75994 seconds