MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Using Nearest on a group of points

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117572] Re: Using Nearest on a group of points
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Wed, 23 Mar 2011 02:53:53 -0500 (EST)

Martin VavpotiÄ? wrote:
>
> Hello. I need some help with the function Nearest.
>
> I have a groups of points, each with two coordinates (x,y), describing
> a connected shape (the last point is a neighbor to the first one). The
> initial order of these points is completely scrambled but I need them
> to follow one another so their sequence describes a combined shape. I
> thought of using the Nearest function but there is a problem.
> Somewhere in the middle of my shape is a large gap where no points
> reside. I fear that if I use Nearest, the function will find the wrong
> point.
>
> What I need is for function Nearest to ignore points already sorted
> and search only for points that have not been used yet.

You might try clustering first. Then use your approach via Nearest on
each cluster. You'll need a different way to connect the clusters.
Probably something like finding the best endpoint pairs, one from each
cluster, to connect. How you define "best" will depend on the problem
at hand. (Are you trying to draw a "smooth" curve? Trying to get
minimal spacing between clusters? Something else?)

There were similar ideas discussed in the very recent thread "Joining
points of ListPlot".

http://forums.wolfram.com/mathgroup/archive/2011/Mar/msg00452.html

Daniel Lichtblau
Wolfram Research


  • Prev by Date: Re: Chop in Mathematica 8.0.1
  • Next by Date: Re: Q for WRI: What % of users are on platform x?
  • Previous by thread: Re: Using Nearest on a group of points
  • Next by thread: Re: Using Nearest on a group of points