2
$\begingroup$

I want to make a complete control net of a torus. However, the net is not closed. Can anyone solve this problem?

pts6 = Table[{(2 + 1 Cos [s])*Cos [t], (2 + 1 Cos [s])*Sin[t], 1 Sin[s]},
  {s, -Pi, Pi}, {t, -Pi, Pi}];
f = BSplineFunction[pts6, SplineClosed -> {True, True}];
Show[
  Graphics3D[{PointSize[Large], Black, Map[Point, pts6]}],
  Graphics3D[{Gray, Line[pts6], Gray, Line[Transpose[pts6]]}],
  ParametricPlot3D[f[s, t], {s, 0, 1}, {t, 0, 1}, AxesLabel -> Automatic]]

torus with control grid]1

$\endgroup$
2
  • $\begingroup$ pts6 = Table[{(2 + 1 Cos[s])*Cos[t], (2 + 1 Cos[s])*Sin[t], 1 Sin[s]}, {s, -Pi, Pi, Pi/4}, {t, -Pi, Pi, Pi/4}]; You have to set an corresponding step size:pts6 = Table[{(2 + 1 Cos[s])*Cos[t], (2 + 1 Cos[s])*Sin[t], 1 Sin[s]}, {s, -Pi, Pi, Pi/4}, {t, -Pi, Pi, Pi/4}]; $\endgroup$ Oct 27, 2020 at 11:06
  • $\begingroup$ Thank you for your explain, and now i already get it! $\endgroup$
    – user75419
    Oct 27, 2020 at 11:31

2 Answers 2

2
$\begingroup$

Ulrich's solution fully answers the question, however, there's a problem with the surface created by BSpliceFunction. Notice that the surface is not a torus, and there's a break at the interior radius (there's a sharp shadow which should be smooth). Use pts6 from Ulrich's solution, and f from the question.

pts6 = Table[{(2 + Cos[t])*Cos[s], (2 + Cos[t])*Sin[s], Sin[t]}, {s, 
    Subdivide[-Pi, Pi, 6]}, {t, Subdivide[-Pi, Pi, 6]}];
f = BSplineFunction[pts6, SplineClosed -> {True, True}];
g1 = Show[Graphics3D[{PointSize[Large], Black, Map[Point, pts6]}],
  Graphics3D[{Thick, Gray, Line[pts6], Line[Transpose[pts6]]}],
  ParametricPlot3D[f[s, t], {s, 0, 1}, {t, 0, 1}]]

original solution

The view from above shows the mesh is unevenly spaced and the surface is not a torus. The cross-section is not circular.

ParametricPlot3D[f[s, t], {s, 0, 1}, {t, 0, 1}, 
  ViewPoint -> {0, 0, \[Infinity]}, 
  PlotLabel -> "non-toroidal surface"]

view above

ParametricPlot3D[f[s, t], {s, 0, 1}, {t, 0, 1},
 RegionFunction -> Function[{x, y, z, u, v}, 0 <= y <= 2],
 BoundaryStyle -> Black, Axes -> True, 
 PlotLabel -> "non-circular cross-section"]

cross-section

When we use the BSplineFunction with the SplineClosed option, the control points must not be closed. BSpineFunction completes the surface by connecting the boundaries. Fix the problem by redefining the spline function as f2 to remove the redundant end points. The result is a torus.

f2 = BSplineFunction[Most[pts6][[All, ;; -2]], SplineClosed -> {True, True}];
ParametricPlot3D[f2[s, t], {s, 0, 1}, {t, 0, 1}, ViewPoint -> {0, 0, \[Infinity]}

torus

Here's the corrected view of the control points with the torus, compared to the original graphic.

g2 = Show[Graphics3D[{PointSize[Large], Black, Map[Point, Most@pts6]}],
  Graphics3D[{Thick, Gray, Line[pts6], Line[Transpose[pts6]]}],
  ParametricPlot3D[f2[s, t], {s, 0, 1}, {t, 0, 1}]]

torus with control grid original solution

$\endgroup$
1
$\begingroup$

The definition of the controlpoints is wrong. {s,-Pi,Pi} inside Table creates an s-grid {_pi,-Pi+1,-Pi+2,...} which doesn't contain the last point Pi.

Redefine the controlpoints to

pts6 = Table[{(2 + 1 Cos[s])*Cos[t], (2 + 1 Cos[s])*Sin[t],1 Sin[s]}, {s, Subdivide[-Pi, Pi, 10]}, {t,Subdivide[-Pi, Pi, 10]}]
$\endgroup$
1
  • $\begingroup$ Really appreciate your explaination on it, thank you very much! $\endgroup$
    – user75419
    Oct 27, 2020 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.