Group Abstract Group Abstract

Message Boards Message Boards

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

Problem with BSplineCurve 3D

Posted 10 years ago

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

enter image description here

Attachments:
POSTED BY: Mikel Manzanal
4 Replies

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

POSTED BY: Marco Thiel
Posted 10 years ago

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.

POSTED BY: Mikel Manzanal
Posted 10 years ago

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

POSTED BY: Mikel Manzanal

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.

enter image description here

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.

enter image description here

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]

enter image description here

Here's a little plot of that:

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

enter image description here

Cheers,

Marco

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