Message Boards Message Boards

0
|
3671 Views
|
6 Replies
|
2 Total Likes
View groups...
Share
Share this post:

BSplineFunction not evaluating as expected in RevolutionPlot3D?

Posted 6 years ago

Hello,

Why does the code (shown below) give this error?

Dot::rect: Nonrectangular tensor encountered.

And how might this code be modified to produce the desired plot?

 controlPoints = {{0., 1.48195}, {0.151384, 1.49651}, {0.330883, 1.39382}, {0.488076, 1.2461}, {0.575162, 1.06331}, {0.599079, 0.886118}, {0.547864, 
      0.698224}, {0.46997, 0.542705}, {0.386957, 0.404801}, {0.285357, 0.28673}, {0.314028, -0.0307762}, {0.202299, -0.0181826}, {0., 0.}};

RevolutionPlot3D[BSplineFunction[controlPoints][t], {t, 0, 1}]
POSTED BY: Rian Shams
6 Replies

Dear Gianluca,

you are of course right! I should have written "It does work, if one represents ...". And: I like your version of BSplineFunction!

Best regards -- Henrik

POSTED BY: Henrik Schachner

With ParametricPlot we don't need to separate the components:

ParametricPlot[BSplineFunction[controlPoints][t], {t, 0, 1}]

Here it is RevolutionPlot3D to be blamed more for the inconvenience.

POSTED BY: Gianluca Gorni
Posted 6 years ago

Thank you! It is unfortunate that BSlpineFunction has some of the shortcomings you address. Yours is a nice modification that preserves the structure of my original answer.

POSTED BY: Rian Shams
Posted 6 years ago

Thank you. This is what I was looking for as it wasn't immediately obvious to me that the components needed to be separated out. Appreciate the help!

POSTED BY: Rian Shams

It does work, one just has to represent the components seperately - according to the examples in the documentation:

{fx, fy} = BSplineFunction /@ Transpose[controlPoints];
RevolutionPlot3D[{fx[t], fy[t]}, {t, 0, 1}]
POSTED BY: Henrik Schachner

Unfortunately BSplineFunction has many shortcomings. It does not honour exact input, it does not obey to PiecewiseExpand, it does not provide the parameterization of BSplineFunction, and now we discover that it does not play well with RevolutionPlot3D. Here is an alternative:

myBSplineFunction[pts_?MatrixQ] := 
  Module[{knots, deg}, 
   knots = Rationalize@BSplineFunction[pts][[6, 1]]; 
   deg = BSplineFunction[pts][[3, 1]];
   Apply[Function, 
    List@Sum[
      pts[[i + 1]] BSplineBasis[{deg, knots}, i, #], {i, 0, 
       Length[pts] - 1}]]];
RevolutionPlot3D[
 Evaluate[myBSplineFunction[controlPoints][t]], {t, 0, 1}]
POSTED BY: Gianluca Gorni
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