MathGroup Archive 2006

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

Search the Archive

Re: Uniform arc length basis curve fitting

  • To: mathgroup at
  • Subject: [mg67429] Re: Uniform arc length basis curve fitting
  • From: christopherpurcell <christopherpurcell at>
  • Date: Fri, 23 Jun 2006 04:31:59 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

This is a nice problem you are posing, with practical applications. I  
have the start of a solution here - leaving lots for you to add. The  
challenge comes in solving for the arc length. I do it here with  
NIntegrate and FindMinimum, but it's slow, and there must be a faster  

(* Fit a curve composed from a set of 2 (or 3) Interpolation  
functions (one for each vector component of the points) to a list of  
points. The fit works for points in 2D and 3D. The curve is  
parameterized by a parameter, say u, such that 0<u<1. *)

p = {{0,0},{1,2},{-1,3},{0,1},{3,0}}; (* the 2d points to fit, could  
also be 3d  *)



(* Define the arc length S of the curve defined by the list of points  
pts, at parameter tt. *)


In[10]:=      S[p,1.] (* the length of the curve *)
Out[10]=    10.6388

(* Now we re-parametrize the curve, using arc length s as the  
parameter. Note to sweep out the entire curve, we now have to let s  
vary from 0 to S[p,1.]. We see the plot looks the same, but it will  
be swept out using arc length as the parameter. This is painfully  
slow to evaluate.  *)

ParametricPlot[Curve[p,(tt /. FindMinimum[Abs[S[p,tt]-s],{tt, 0, 1}] 

(* We can demonstrate that this is arc length by creating points  
along the curve, and we see the points are nicely spaced. *)

ListPlot[Table[Curve[p,(tt /. FindMinimum[Abs[S[p,tt]-s],{tt, 0, 1}] 

(* By comparison here we plot points using our initial  
parametrization, and if you look closely you will see they are not  
evenly spaced along the curve. *)


I leave it to you to implement your tangent vectors, curvatures, etc.

  christopherpurcell at

On Jun 19, 2006, at 1:01 AM, Narasimham wrote:

> How to find slopes, curvature etc. of cubic splines as a function of
> arc length? With this example from Help,attempted to find piecewise
> derivatives, but it cannot be right as the given pts need not be  
> spaced
> evenly on the arc. TIA.
> << NumericalMath`SplineFit`
> pts = {{0,0},{1,2},{-1,3},{0,1},{3,0} };
> spline = SplineFit[pts, Cubic] ;
> plspl=ParametricPlot[spline[u], {u, 0, 4}, PlotRange -> All, Compiled
> -> False];
> "derivative components"
> der[x_]:=( spline[x+10^-10]-spline[x-10^-10] ) /( 2 10^-10);
> dxu[x_]:=der[x].{1,0}; dxv[x_]:=der[x].{0,1};
> Plot[{dxu[v],dxv[v]},{v,0,4}];
>  ">>> slopes >>>"
> Plot[ArcTan[dxu[v],dxv[v]] ,{v,0,4}] ;
> plder=ParametricPlot[der[v],{v,0,4}] ;
> der[2]
> Show[plspl,plder];

  • Prev by Date: Re: Please Help a student...
  • Next by Date: Re: Interrogating lists of unequal lenghths
  • Previous by thread: Re: Uniform arc length basis curve fitting
  • Next by thread: Re: Uniform arc length basis curve fitting