B-Spline

Buch:Höhere Mathematik sehen und verstehen, Haftendorn, Riebesehl, Dammer, 
Springer Spektrum, Feb. 2021
Datei NURBS-Torus.nb zu Abschnitt 5.4.3.4 Seite 381, Abb. 5.24

Torus

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

w={{1,.5,.5,1,.5,.5,1},{1,.5,.5,1,.5,.5,1}/2,{1,.5,.5,1,.5,.5,1}/2,{1,.5,.5,1,.5,.5,1},{1,.5,.5,1,.5,.5,1}/2,{1,.5,.5,1,.5,.5,1}/2,{1,.5,.5,1,.5,.5,1}};

uk={0,0,0,1/4,1/2,1/2,3/4,1,1,1};

vk={0,0,0,1/4,1/2,1/2,3/4,1,1,1};

Graphics3D[{Point[Flatten[pts,1]],Line[pts],Line[pts//Transpose]},Axes->True]

Graphics3D[{
FaceForm[Yellow],
BSplineSurface[pts,SplineKnots->{uk,vk},SplineDegree->2,SplineWeights->w,SplineClosed->{True,True}]},ViewPoint->{Right,Front},Boxed->False]

Graphics3D[{
FaceForm[Yellow],Opacity[0.7],PointSize[0.03],
BSplineSurface[pts,SplineKnots->{uk,vk},SplineDegree->2,SplineWeights->w,SplineClosed->{True,True}],Point[Flatten[pts,1]],Line[pts],Line[pts//Transpose]},ViewPoint->{Right,Front},Boxed->False]

Ellipse: Vorbereitung mit Kurven

pts={{.5,0},{1,0},{1,2},{.5,2},{0,2},{0,0}};
w={1,.5,.5,1,.5,.5};
k={0,0,0,1/4,1/2,1/2,3/4,1,1,1};

Graphics[{BSplineCurve[pts,SplineDegree->2,SplineKnots->k,SplineWeights->w,SplineClosed->True],Green,Line[pts],Red,PointSize[0.02],Point[pts]}]

Kreis: spezielle Ellipse

pts={{.5,0},{1,0},{1,1},{.5,1},{0,1},{0,0},{.5,0}};
w={1,.5,.5,1,.5,.5,1};
k={0,0,0,1/4,1/2,1/2,3/4,1,1,1};

Graphics[{BSplineCurve[pts,SplineDegree->2,SplineKnots->k,SplineWeights->w],Green,Line[pts],Red,PointSize[0.02],Point[pts]}]

Rohr: Vorbereitung und Anregung für den Torus

pts={{{0.6, 0, -0.5}, {0, 0, -0.5}, {0, 1, -0.5}, {0.5, 1, -0.5}, {1, 1, -0.5}, {1, 0, -0.5}, {0.5, 0, -0.5}}, 
 {{0.5, 0, 0.7}, {0, 0, 0.7}, {0, 1, 0.7}, {0.5, 1, 0.7}, {1, 1, 0.7}, {1, 0, 0.7}, {0.5, 0, 0.7}}, 
 {{0.5, 0, 0.9}, {0, 0, 0.9}, {0, 1, 1.5}, {0.5, 1, 1.5}, {1, 1, 1.5}, {1, 0, 0.9}, {0.5, 0, 0.9}}, 
 {{0.5, -0.1, 1}, {0, -0.1, 1}, {0, 0.5, 2}, {0.5, 0.5, 2}, {1, 0.5, 2}, {1, -0.1, 1}, {0.5, -0.1, 1}}, 
 {{0.5, -0.3, 1}, {0, -0.3, 1}, {0, -0.3, 2}, {0.5, -0.3, 2}, {1, -0.3, 2}, {1, -0.3, 1}, {0.5, -0.3, 1}}, 
 {{0.5, -1.5, 1}, {0, -1.5, 1}, {0, -1.5, 2}, {0.5, -1.5, 2}, {1, -1.5, 2}, {1, -1.5, 1}, {0.5, -1.5, 1}}};

w={{1,.5,.5,1,.5,.5,1},{1,.5,.5,1,.5,.5,1},{1,.5,.5,1,.5,.5,1},{1,.5,.5,1,.5,.5,1},{1,.5,.5,1,.5,.5,1},{1,.5,.5,1,.5,.5,1}};

uk={0,0,0,1/4,1/2,3/4,1,1,1};

vk={0,0,0,1/4,1/2,1/2,3/4,1,1,1};

Graphics3D[{Point[Flatten[pts,1]],Line[pts],Line[pts//Transpose]},Axes->True]

Graphics3D[{
FaceForm[Yellow,Blue],
BSplineSurface[pts,SplineKnots->{uk,vk},SplineDegree->2,SplineWeights->w,SplineClosed->{False,True}]},ViewPoint->{Right,Front},Boxed->False]