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?
1 Answer
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:
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. Jan 24, 2014 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_pJan 24, 2014 at 9:44
tikz
answer.