8

I need to draw a couple of interlocking tori, as in the picture, using Tikz.

Interlocking Tori

I've been looking at some examples online and all I find is instructions to do it with Gnuplot, nothing about Tikz. If anyone could help I would deeply appreciate it.

11

You can plot 4 half tori like this :

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\pgfplotsset{
  torus/.style 2 args={
    surf,
    color=#1!50,faceted color=#1,
    samples=17,
    z buffer=sort,
    domain=0:360, y domain=#2:#2+180
  }
}
\def\m{sin(x)}
\def\n{(2+cos(x))*sin(y)}
\def\p{(2+cos(x))*cos(y)}

\begin{document}
  \begin{tikzpicture}
      \begin{axis}[hide axis,axis equal,scale=3,view={20}{20}]
        \addplot3[torus={blue}{0}] (\m,\n,\p);
        \addplot3[torus={red}{0}] (\p,\n-2,\m);
        \addplot3[torus={blue}{180}] (\m,\n,\p);
        \addplot3[torus={red}{180}] (\p,\n-2,\m);
      \end{axis}
  \end{tikzpicture}
\end{document}

enter image description here

  • 1
    To make the tori look "circular" rather than "elliptic", you can use the unit vector ratio=1 1 1 option or axis equal. – Tom Bombadil Nov 28 '15 at 23:46
5

Run with xelatex:

\documentclass[pstricks]{standalone}
\usepackage{pst-solides3d}
\begin{document}

\psset{Decran=50,viewpoint=20 80 30,lightsrc=viewpoint,action=none}
 \begin{pspicture}[solidmemory](-4,-3)(3,3)
    \psSolid[r1=2.5,r0=1.5,object=tore,ngrid=18 36,fillcolor=green!30,name=tA]
    \psSolid[r1=2.5,r0=1.5,object=tore,ngrid=18 36,fillcolor=blue!30,RotX=90,name=tB](2,0,0) 
    \psSolid[object=fusion,base=tA tB,action=draw**]
\end{pspicture}

\end{document}

enter image description here

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.