1
$\begingroup$

How to hide a part of a torus. I mean in the following torus

ParametricPlot3D[{ (3 + Cos[v]) Sin[u], (3+ Cos[v]) Cos[u], Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}]

I want to hide the shaded part enter image description here

$\endgroup$
  • $\begingroup$ Try {u, -Pi/8, Pi/8}. Is that what you mean? $\endgroup$ – Rohit Namjoshi Jun 20 at 5:33
1
$\begingroup$

Simplest way is to change the u range as suggested by Rohit in comments.

A few additional methods:

Using RegionFunction:

ParametricPlot3D[{(3 + Cos[v]) Sin[u], (3 + Cos[v]) Cos[u], 
  Sin[v]}, {u, -Pi, Pi}, {v, 0, 2 Pi}, 
 RegionFunction -> (-Pi + Pi/16 <= #4 <= Pi - Pi/16 &)]

enter image description here

Using MeshFunctions + Mesh + MeshShading:

ParametricPlot3D[{(3 + Cos[v]) Sin[u], (3 + Cos[v]) Cos[u], 
  Sin[v]}, {u, -Pi, Pi}, {v, 0, 2 Pi}, MeshFunctions -> {#4 &}, 
 Mesh -> {{-Pi + Pi/16, Pi - Pi/16}}, 
 MeshShading -> { Automatic,Opacity[.1], Automatic}, 
 Axes -> False, Boxed -> False]

enter image description here

$\endgroup$
  • $\begingroup$ Thanks! Can I also remove the frame box and the axes? I mean I only need the torus! $\endgroup$ – user21210 Jun 20 at 5:58
  • $\begingroup$ I actually got another question here. I would like to have the wrapping line (ParametricPlot3D[{Cos[Sqrt[2] t](3 + Cos[t]), Sin[Sqrt[2] t] ( 3+Cos[t]),Sin[t]}, {t, 0, 50}}) only on the shown part of the torus above. Can I do that? Thanks a lot ! $\endgroup$ – user21210 Jun 20 at 6:29
  • 1
    $\begingroup$ @AbdelRahmanAl-Amrat, can think of a quick answer b/c the scales are not the same. $\endgroup$ – kglr Jun 20 at 7:37
  • $\begingroup$ I have tried to modify the picture based on your answer to this question. I am sorry, I thought the idea of doing things in Mathematica is the same always. I asked a new question about animation again including the situation above. If you can help me in answering this new question that would be very great.. Thank you so much! mathematica.stackexchange.com/questions/200699/… $\endgroup$ – user21210 Jun 20 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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