Message Boards Message Boards

Visualization knot insertion of BSpline wiht de Boor's algorithm

NOTE: The complete notebook of this post is attached at the end.


spikey in action

separated spline mesh

Recently I was reviewing my spline notes. One thing basic yet still attracts me much is the de Boor algorithm. It links the nonlinear, flexible spline curves with nested linear relationships in a rather elegant way.

In the title animation, a repeated knot insertion process is demonstrated. A new knot at position newU is inserted as many times as the degree of the spline. Each diagram with different color represent a refined knot vector along with a refined control point set. By using the built-in B-spline utilities like BSplineCurve and BSplineFunction, each one constructs to the same B-spline curve, with the same parameterization.

It might be more intuitive and visually interesting by stacking those diagrams together. From the stacking result, we can see clearly how each active control points always "sliding" along the edges of their "parent" control polygons. A "LakeColors" scheme is chosen here to give a feeling of blueprint, but it will surely be fun to play with other color schemes by yourself. ;)

stacked spline mesh

For those who are interested in further exploration, inside the attached notebook (i.e. this one) we have a function splineConfigGen ready for help. It can be used to generate random B-spline configuration and store it to the first argument.

splineConfigGen[myBScfg , <|
                            "NumCpts" -> 9, "degree" -> 6
                          , "?radius" -> 2, "?angle" -> 0, "?knot" -> .3
|>]

myBScfg // Function[
     {
         {GrayLevel[0.7], CapForm[None], 
          AbsoluteThickness[2],
          BSplineCurve[#cpts, SplineKnots -> #knots]
         }
       , {Hue[0.08333333333333333, 0.4, 1], CapForm[None], 
          AbsoluteThickness[1],
          Line[#cpts]
         }
       , {FaceForm[GrayLevel[1]], EdgeForm[{Hue[0.08, 1., 1.], Thickness[.005]}],
          GeometricTransformation[Disk[{0, 0}, .02], 
          TranslationTransform /@ #cpts]
         }
     }
   ] //
 Graphics[{#, GrayLevel[0.8], Circle[{0, 0}, 1]}
          , Axes -> True, AxesOrigin -> {0, 0}
          , BaseStyle->{BSplineCurveBoxOptions->{Method->{"SplinePoints"->100}}}
 ] &

random b-spline

The separated and stacked diagrams can be plot easily.

BSAnimationSeperated[ myBScfg ]

random spline mesh separated

BSAnimationStacked[ myBScfg ]

random spline mesh stacked

And one may even discover some nice icon from the found spline.

BSLineArt[ myBScfg ]

random spline line art

Bonus for the new year!

20 knot-insertion processes running on spikey synchronously!

spikey in action

Attachments:
POSTED BY: Silvia Hao

enter image description here - Congratulations! This post is now a Staff Pick as distinguished by a badge on your profile! Thank you, keep it coming, and consider contributing your work to the The Notebook Archive!

POSTED BY: Moderation Team
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