Group Abstract Group Abstract

Message Boards Message Boards

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

Sampling strategy of built-in BSplineSurface?

Posted 9 years ago

Today, I test a set of points using the built-ins BSplineSurface[] and BSplineFunction[], respectively.

(*about nets and knots, please see the addendum's link*)
Graphics3D[BSplineSurface[nets, SplineKnots -> knots]] // AbsoluteTiming

enter image description here

h = BSplineFunction[nets, SplineKnots -> knots]
ParametricPlot3D[h[x, y], {x, 0, 1}, {y, 0, 1}] // AbsoluteTiming

enter image description here

Show[{ParametricPlot3D[h[x, y], {x, 0, 1}, {y, 0, 1}], 
      Graphics3D[{Opacity[0.5], 
                  BSplineSurface[nets, SplineKnots -> knots]}]}, 
     Boxed -> False, Axes -> False]

enter image description here

Obviously, the surface generated by BSplineSurface[] is very smooth, especially at the corner. In addtion, it is also much faster than the latter. However, for the combination of ParametricPlot3D[] and BSplineFunction[], which cannot generate a smooth surface when without the help of option PlotPoints -> 100(That's means, it will take more time to compute!).

So I have the following question:

  • What strategy does they use to sample the 3D points?

Addendum

The nets and knots vector that in the V direction could be downloaded from here and here, respectively. (Thanks for happy fish's help:))

Moreover, the knots vector that in the U direction is:

U = {0.,0.,0.,0.,0.502247,1.,1.,1.,1.};
knots = {U, V};
POSTED BY: Shutao Tang
4 Replies
Posted 9 years ago

Thanks. If memeory serves, the classical deBoor algorithm just computes the coordinate of B-spline curve using the corner-cutting strategy, which is a generlization of de-Casteljau algorithm. So I think it has no relationship with the ultimate surface rendering.

POSTED BY: Shutao Tang

I don't know what is used internally, but i'd bet they are completely different implementations. It might be e.g.:

https://en.wikipedia.org/wiki/DeBoor%27salgorithm

I'm positive @Yuzhu Lu knows and might reveal what is used internally to draw splines and bezier curves...

POSTED BY: Sander Huisman
Posted 9 years ago

Thanks a lot for your answer. Although adding option PlotPoints -> {n, m} in ParametricPlot3D[] could improve the quality of the corresponding surface, it also takes more time to compute. So I would like to know what is the specialised techniques? Is there any classical references I could refer to?

POSTED BY: Shutao Tang

For ParametricPlot3D it will start with PlotPoints, and then (at most) MaxRecursion time it will split this in two (in both direction for a surface) based on the curvature of the surface. See also the documentation of:

https://reference.wolfram.com/language/ref/Plot.html

enter image description here

Spline surfaces are drawn not using this technique, there are drawn using specialised techniques that are very fast (for splines) but do not rely on 'sampling points' and recursively refining (I presume, I don't have the source code...). This can be done for splines, but for a general function this is not possible. ParametricPlot will treat your function h as a 'general function' and is unaware that it is a spline surface...

To Help your parametric plot, you could specify the option:

PlotPoints ->{n,m}

And change them individually, you definitely need more in the circumferential direction, and you can probably can get away with less in the 'axial' direction...

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