Problem with BSplineCurve 3D

I have a problem using the function BSplineCurve [ ] . I have to represent a line passing through about 3000 points in 3D. I managed to plot the points separately, but when I use the 3D BSplineCurve [] example , the result is in a plane. besides , I have to calculate the length of the line through these points .

Thanks

Dear Mikel,

the result is actually not a plane. What happens it that the third coordinate is 5-6 orders of magnitude smaller than the other two components. This is why, when you plot it, It can be mistaken for a plane.

If you use

Graphics3D[{BSplineCurve[points]}, BoxRatios -> {1, 1, 1}, ImageSize -> Medium]

you see what is going on.

3dplot.gif

You can then also use your function

Graphics3D[{BSplineCurve[points], Green, Line[points], Red, Point[points]}, BoxRatios -> {1, 1, 1}, ImageSize -> Medium]

to achieve the same effect.

3d2.gif

The Length might then be:

ArcLength@DiscretizeGraphics@BSplineCurve[points]
 (*165671.*)

The length will, of course depend on the degree of the spline. Here is a little table to show that:

Insert[Grid[Join[{{"Degree", "Length"}}, Table[{deg, NumberForm[
      ArcLength@DiscretizeGraphics[BSplineCurve[points, SplineDegree -> deg]], 16]}, {deg, 1, 8}]]], 
      {Background -> {None, {GrayLevel[0.7], {White}}}, Dividers -> {Black, {2 -> Black}}, Frame -> True, Spacings -> {2, {2, {0.7}, 2}}}, 2]

Here’s a little plot of that:

ListLinePlot[
 Table[{deg, ArcLength@DiscretizeGraphics[BSplineCurve[points, SplineDegree -> deg]]}, {deg, 1, 30}], AxesLabel -> {"degree", "length"}]

Cheers,

Marco

Thank you very much for your help, am new to this forums, and also in Mathematica. Thanks for your help

Thank you very much for your help, I’am new in this forums, and also in Mathematica. Thanks for your help
I still have a question. If u modify the boxratio the lenght is not modified too?
Sorry for my english.

Dear Mikel,

The BoxRatios is nothing to worry about. It only concerns the representation. If you have a look at the line where I calculate the length of the curve:

ArcLength@DiscretizeGraphics@BSplineCurve[points]

there is no mention of the box ratios. So that is not a problem. You might want to look at the documentation of ArcLength and DiscretizeGraphics to study the available options.

Cheers,

Marco