0

Is there a simple way to produce in TikZ a two-torus rounded by two circles, each with the non-visible half dashed, as in the sketch?enter image description here

  • possible duplicate of Drawing the contour of a 3d torus – jubobs Jan 10 '14 at 15:47
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – jubobs Jan 10 '14 at 15:47
  • @Jubobs: I don't think it's a duplicate question. The question you link to has a similar image produced with tikz in the question itself, but the tikz code is not provided. – Charles Staats Jan 10 '14 at 15:52
  • @CharlesStaats Well, this question is surely a duplicate of the one I link to, although the latter doesn't have a tikz answer. – jubobs Jan 10 '14 at 15:53
  • Thanks. The question you link has an image similar to what I'd like to obtain, possibly using tikz, even though I can't find the code; another thing, the question refers to 2d vs 3d, but I'm not sure whether in my case this matters or not – jj_p Jan 10 '14 at 15:57
5

As you may or may not have found out, tori are difficult to code precisely on a 2D surface (because it is a projection from 3D). In that spirit, I drew your picture as it is, just by trial and error, finding the right lengths. It's definitely not a clean way to do it, but I think it works for difficult pictures like this. No extra TikZ packages are needed. Here is the code:

\begin{tikzpicture}[rotate=180]
%Torus
\draw (0,0) ellipse (1.6 and .9);
%Hole
\begin{scope}[scale=.8]
\path[rounded corners=24pt] (-.9,0)--(0,.6)--(.9,0) (-.9,0)--(0,-.56)--(.9,0);
\draw[rounded corners=28pt] (-1.1,.1)--(0,-.6)--(1.1,.1);
\draw[rounded corners=24pt] (-.9,0)--(0,.6)--(.9,0);
\end{scope}
%Cut 1
\draw[densely dashed] (0,-.9) arc (270:90:.2 and .365);
\draw (0,-.9) arc (-90:90:.2 and .365);
%Cut 2
\draw (0,.9) arc (90:270:.2 and .348);
\draw[densely dashed] (0,.9) arc (90:-90:.2 and .348);
\end{tikzpicture}

This is the result:

enter image description here

Some things I am displeased with in my code:

  • I drew the hole with the lips going the other way before I realized you had it your way. So I just put [rotate=180] at the beginning instead of making the code appropriate. Just delete that to flip it back.

  • Initially the hole was too small, but it had kind of the right curvature. So I just scaled the whole hole until it looked better, hence the {scope}[scale=.8] part.

  • I think the two half-solid-half-dashed cuts should both be both going the same way, personal opinion. But it's your picture, so there you go. If you do want to do that, cut and paste [densely dotted] from one to the other lines of the same cut.

Conclusion: I have a bad (but visually OK) solution for a simple (but code-wise difficult) drawing.

  • shoudn't it be this way: %Cut 2 \draw [densely dashed](0,.9) arc (90:270:.2 and .348); \draw (0,.9) arc (90:-90:.2 and .348); ? I think both circles have to look in the same direction? Correct me if I'm wrong. – schmendrich Jan 24 '14 at 9:23
  • Thanks for your answer. Yes, I came up with something very similar in the end, and yes, the dashed lines should look as you sugggest. – jj_p Jan 24 '14 at 9:44

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.