Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Uniform arc length basis curve fitting

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67452] Re: Uniform arc length basis curve fitting
  • From: "Dana DeLouis" <ddelouis at bellsouth.net>
  • Date: Sun, 25 Jun 2006 03:19:20 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi.  I do not know if this will help, but here is a general discussion of
finding the arc length of the Cubic Spline example.

Needs["NumericalMath`SplineFit`", "Graphics`Spline`"]

pts = {{0, 0}, {1, 2}, {-1, 3}, {0, 1}, {3, 0}}; 

Show[Graphics[Spline[pts, Cubic, SplineDots -> Automatic], 
	GridLines -> {{-1, 0, 1, 2, 3}, {0, 1, 2, 3}}], Axes -> True]; 

With 5 points, there are 4 intervals as observed in the above graph.
A Spline generates a cubic equation for each of the 4 intervals, numbered 0,
1, 2 & 3.

Here's that Spline Function...

sf = SplineFit[pts, Cubic]; 

The variables for the cubic Polynomials are the last item (4th) in the
SplineFuntion object.

sf[[4]]  or Last[sf]

The valid range of the Spline Function is the Second item... sf[[2]]

Here's a function to put the Spline variables into a better form.  I will
use the variable 't'.

SplineEquations[sf_SplineFunction, v_Symbol:t] := 
  Module[{m = Last[sf]}, (#1 . {1, v, v^2, v^3} & ) /@ m]

Here's a list of all the Spline Equations:

se = SplineEquations[sf]

TableForm[se, TableHeadings -> {{0, 1, 2, 3}, {"X", "Y"}}]

When you do a plot of a Spline from 0 to 4, the integer portion of the
number picks which equation to use,
and the fractional part, which runs from 0 to 1, is used to determine the x
& y points.
For example, a number like 0.5 is taken to mean the following...The 0 is
used to select the first equation, and the 0.5 is used as 't above to
determine the x & y points.

A number like 1.7 is taken to mean "use the second equation, and use 0.7 to
determine the x & y points.

The number '4 in the valid range is a little different...it just means use
equation #3 (the 4th one), but use a value of '1 to determine x & y. (At the
end of the interval).

We just note item #12 in the following link:
http://mathworld.wolfram.com/ArcLength.html

Here's a function to return the Arc Length equations:

ArcLengthEquation[{x_, y_}, v_Symbol] := 
  Module[{equ}, equ = Norm[D[{x, y}, v]]; 
    Assuming[0 <= v <= 1, Simplify[equ]]]

Here's the Arc Length equation of the second interval...

ArcLengthEquation[se[[2]], t]

(3/56)*Sqrt[1620 + 3672*t + 4952*t^2 - 23172*t^3 +  13565*t^4]

The actual Arc Length is calculated from 0 to 1.  We note here that the
symbolic integral is rather difficult, so that makes calculating x/y points
from a given length rather hard.

ArcLength[{x_, y_}, v_Symbol] := 
  Module[{equ}, equ = ArcLengthEquation[{x, y},  v]; NIntegrate[equ, {v, 0,
1}]]

We Map it onto each of the 4 parametric equations to get each Arc Length:

(ArcLength[#1, t] & ) /@ se

{2.381081440098988, 2.3750200913641875, 2.4204208569360257,
3.1974584672827886}

The total length of the graph is:

Total[%]
10.373980855681989

I hope this helps in some way.

Dana DeLouis
Mathematica 5.2 for Windows



  • Prev by Date: Re: Quaternion problem
  • Next by Date: Re: How can I graph 3D vectors in Mathematica?
  • Previous by thread: Re: Uniform arc length basis curve fitting
  • Next by thread: puzzling revolution surface