Message Boards Message Boards

0
|
5728 Views
|
4 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Spline length of an approximated polar curve

Posted 10 years ago

Dear all,

I think for many user of wolfram this question is easy, but I am starting to get used to the program and all its features and for that I think it is the best way to learn from the people who use mathematica every day for a long time.

Problem: I have 10 arbitrarily points which are in one plane. First of all I would like to make a closed spline through all of these 10 points and would like to express the curve in polar coordinates. (The curve will approximatly look like an egg.)

I think I can visualise this by using the: << Splines`; Graphics[Spline[{{...,...}, {...,...}, {...,...}, {...,...}}, Bezier]]

But this only helps me to visualise the curve. To get the length of the spline I would like to get an approximated function to all these points and want to calculated the derivative of the function.

My question: How can I get an approximated curve through all of my 10 points with an polar expression? Should I use "InterpolatingFunction", "BSplineFunction" or "InterpolatingPolynomial"? What are the advantages of these differet Functions and which of these will help to get me the polar function -> length of my spline?

I would be glade to get some ideas to get the problem solved.

Thank you very much!

Best regards. Alex

POSTED BY: Alexander Pieper
4 Replies

Dear Mr. Morozov,

many thanks for your quick answer. Thank you for you interesting solution!

Best regards,

Alex

POSTED BY: Alexander Pieper

Have you seen this post Computing arch length of a spline curve?

POSTED BY: Udo Krause

Hi, Alexander,

Not sure why you want to get the curve in polar coordinates, but to compute the length any parameterization will do. Here is an example:

points = Table[{{Cos[x], Sin[x]}}, {x, Pi/15., 2. Pi - Pi/15., Pi/6.}];

{x, y} = Interpolation[#, PeriodicInterpolation -> True, 
     InterpolationOrder -> 10] & /@ 
    Transpose[
    PadRight[Flatten[points, 1], Length[points] + 1, points[[1]]]] ;

S1 = NIntegrate[
  Sqrt[(x'[s])^2 + (y'[s])^2], {s, 1, Length[points] + 1}]
S1 - 2 Pi

Show[
 ParametricPlot[{x[s], y[s]}, {s, 1, Length[points] + 1}, 
  AspectRatio -> 1, Frame -> True, PlotStyle -> {Black, Dashed, Thin}],
 ListPlot[
    points,
    PlotMarkers -> ToString /@ Range[Length[points]]
  ]
 ]

For BSplineFunction[] the answer is quite off:

z = BSplineFunction[Flatten[points, 1], SplineClosed -> True];
ParametricPlot[z[s], {s, 0, 1}]
Plot[{z[s], z[0]}, {s, 0, 1}]
NIntegrate[Sqrt[Inner[Power, z'[s], {2, 2}, Plus]], {s, 0, 1}, Evaluated -> False]

Can someone comment on the result for BSplineFunction[]? Also, it looks like ParametricRegion[] doesn't work properly for BSplineFunction[].

I.M.

POSTED BY: Ivan Morozov

As far as I know, a curve defined by a BSplineFunction goes through only the first and last members of the list of points, and the rest of the points are interpreted as knots of the BSpline. So the arc length of the BSpline curve you created will not agree with your integration along the curve defined by Interpolation (which does go through all the points).

By the way, I am finding that although BSplineFunction applied to lists of 2D and 3D data evaluate and plot fine, a number of built in routines like ParametricRegion and ArcLength fail on these constructions. I have more success when I apply a BsplineFunction to each vector component separately.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract