Message Boards Message Boards

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

Spline length of an approximated polar curve

Posted 10 years ago
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