# How to draw interlocking tori with Tikz?

I need to draw a couple of interlocking tori, as in the picture, using Tikz. 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.

• No exact matches, but tex.stackexchange.com/questions/70090/… is a good start. May 25, 2015 at 21:38
• Draw a smooth surface is another relevant post. No Tikz solution, but more than Gnuplot.
– DJP
May 27, 2015 at 15:33
• This is pretty much a PStricks, Asymptote and so on task. May 27, 2015 at 17:28
• Sep 28, 2015 at 7:54

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}]
\end{axis}
\end{tikzpicture}
\end{document} • To make the tori look "circular" rather than "elliptic", you can use the unit vector ratio=1 1 1 option or axis equal. Nov 28, 2015 at 23:46

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} A bit late to the party, but here's a solution using asymptote.

/*  Used for rendering parameterized 3D objects.                              */
import graph3;

/*  PDF works best with LaTeX, output this. Also set the render factor high.  */
import settings;
settings.outformat = "pdf";
settings.render = 8;

/*  Size of the image. For 3D objects it seems best to have this set to a     *
*  power of 2, otherwise weird vertical or horizontal black lines may appear.*/
size(256);

/*  How the image is being drawn on a 2D picture.                             */
currentprojection = perspective(5.0, 4.0, 4.0);

/*  Two radii defining the torus.                                             */
real R = 3.0;
real a = 1.3;

/*  Material the two torii are made of.                                       */
material blueblob = material(
diffusepen = blue + 0.25*green,
emissivepen = gray(0.2),
specularpen = gray(0.2)
);

material redblob = material(
diffusepen = red,
emissivepen = gray(0.2),
specularpen = gray(0.2)
);

/*  Function for drawing the torus.                                           */
triple torus_parameterization(pair t)
{
/*  The parameterization is in terms of sine and cosine of 2 pi t.x and   *
*  2 pi t.y. Precompute these to avoid repetitive calculations.          */
real u = 2.0*pi*t.x;
real v = 2.0*pi*t.y;
real cosu = cos(u);
real cosv = cos(v);
real sinu = sin(u);
real sinv = sin(v);

/*  Given the two angles u and v, the x, y, and z coordinates are:        */
real x = (R + a*cosv)*cosu;
real y = (R + a*cosv)*sinu;
real z = a*sinv;

/*  Return the point (x, y, z), which is a point on the surface.          */
triple out = (x, y, z);
return out;
}
/*  End of torus_parameterization.                                            */

/*  Create the first torus.                                                   */
surface t0 = surface(torus_parameterization, (0.0, 0.0), (1.0, 1.0), Spline);

/*  The second torus is obtained by rotating and shifting.                    */
surface t1 = shift((R, 0.0, 0.0))*(rotate(90.0, (1.0, 0.0, 0.0))*t0);

/*  Draw both of the torii.                                                   */
draw(t0, surfacepen = redblob, render(merge=true));
draw(t1, surfacepen = blueblob, render(merge=true)); 