MathGroup Archive 2009

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

Search the Archive

Re: ListCurvePathPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96111] Re: ListCurvePathPlot
  • From: ucervan at gmail.com
  • Date: Thu, 5 Feb 2009 04:40:06 -0500 (EST)
  • References: <200901291058.FAA18253@smc.vnet.net> <200902010941.EAA22811@smc.vnet.net>

The problem with InterpolationOrder  is going to be fixed in the next
release. Thanks for pointing out this oversight and we appreciate
reporting this issue to the Tech Support team.

With respect to what is the use of this function, consider the problem
of having an arbitrary sequence of 2d points that you know are part of
a connected curve, and you want to reconstruct the curve.

One solution is given by FindShortestTour[], try this:

pts = Table[{x = RandomReal[{0, 6 Pi}]; r = x/(2 Pi); r Sin[x],
    r Cos[x]}, {200}];

FindShortestTour[pts]; // Timing


On my system this takes around 7 sec. The shortest tour problem is an
NP problem, if you have time try the previous example with 1000 pts.
So, in general the problem of reconstructing a curve using a shortest
tour approach will be very expensive for large number of samples.

If you are in a situation where you can accept an approximation to the
curve and allow for possible gaps, then you should consider
FindCurvePath[], try:

FindCurvePath[pts]; // Timing

on my system this takes 0.032s for 200 pts and 0.36sec for 1000 pts.

FindCurvePath[] is a fast curve reconstruction, which may or not be
connected. In general if you have a sufficiently dense sample of
"connected" points, then the solution found by FindCurvePath will be
very close to the real shortest tour.

If you give a random sequence of points, then the result may seem
useless since the assumption for the FindCurvePath algorithm is that
the data is part of a curve. This computational geometry problem is
know as Curve Reconstruction and is used for hand writing recognition,
extraction of features in image processing, raster to vector graphics
operations, etc.


Going back to ListCurvePathPlot, the implementation of
InterpolationOrder is just:

pts = Table[{x = RandomReal[{0, 2 Pi}]; x, Sin[x]}, {15}];
plot = ListCurvePathPlot[pts];
plot /. {Line[pp_] -> BSplineCurve[pp, SplineDegree -> 3]}

We appreciate any comments and we encourage you to report any problems
to tec. support.


-Ulises Cervantes
Wolfram Research
Kernel Developer




  • Prev by Date: Re: Re: Printing (v7)
  • Next by Date: weighted averages from 2 matrices
  • Previous by thread: Re: Re: Re: Re: ListCurvePathPlot
  • Next by thread: Re: Printing (v7)