Spline

Author

Eric W. Weisstein
June 26, 2003

This notebook downloaded from http://mathworld.wolfram.com/notebooks/NumericalMath/Spline.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/Spline.html.

©2003 Wolfram Research, Inc. except for portions noted otherwise

Plots

pts={{0,0},{1,2},{-1,3},{0,1},{3,0}};

V5

Initialization

<<Graphics`Spline`
<<Utilities`GIF`

Plot

movie=With[{n=20,r=.5},
Show/@Table[pts2=Join[
{pts[[1]]},
r{Cos[2Pi i/n],Sin[2Pi i/n]}+#&/@Delete[pts,{{1},{-1}}],
{pts[[-1]]}];
Graphics[{
{Red,Spline[pts2,Cubic]},
{Green,Spline[pts2,CompositeBezier]},
{Blue,Spline[pts2,Bezier]},
{Line[pts2],PointSize[.02],Point/@pts2}
},PlotRange->{{-2,3.1},{-.1,4.5}}],{i,n}]
]

Export[gifs<>"spline.gif",movie]//Timing

V7

Options[BSplineCurve]

Graphics[{
{Red,BSplineCurve[pts,SplineDegree->3]},
{Green,BSplineCurve[pts,SplineDegree->2]},
{Blue,BezierCurve[pts]},
{Line[pts],PointSize[.02],Point/@pts}
}]

movie=With[{n=20,r=.5},
Show/@Table[pts2=Join[
{pts[[1]]},
r{Cos[2Pi i/n],Sin[2Pi i/n]}+#&/@Delete[pts,{{1},{-1}}],
{pts[[-1]]}];
Graphics[{
{Red,BSplineCurve[pts,SplineDegree->3]},
{Green,BezierCurve[pts]},
{Blue,BSplineCurve[pts]},
{Line[pts],PointSize[.02],Point/@pts}
},PlotRange->{{-2,3.1},{-.1,4.5}}],{i,n}]
]