# Filling the middle of a torus in Tikz

I drawed the following torus using Tikz:

\begin{tikzpicture}
\fill[blue] (7.5,0) ellipse (1 and .75);
\draw (7.5,0) ellipse (1 and .75);
\begin{scope}
\clip (7.5,-.9) ellipse (1 and 1.25);
\draw (7.5,1.1) ellipse (1 and 1.25);
\end{scope}
\begin{scope}
\clip (7.5,1.1) ellipse (1 and 1.25);
\draw (7.5,-1.1) ellipse (1 and 1.25);
\end{scope}
\end{tikzpicture}


I want to color the middle of it white, so it can really look like a torus. How could I do it?

• Have you searched this site for tori? Mar 24 '19 at 11:46
• @BenjaminMcKay Yes, I did. I think I viewed every post about tori here and not a single one solves my problem. Mar 24 '19 at 11:46
• You can check my (new) answer of the (old) question How to draw a torus.
– Kpym
Mar 31 '19 at 16:31

\documentclass{article}
\usepackage{tikz}
%\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\fill[blue] (7.5,0) ellipse (1 and .75);
\draw (7.5,0) ellipse (1 and .75);
\begin{scope}
\clip (7.5,-.9) ellipse (1 and 1.25);
\draw(7.5,1.1) ellipse (1 and 1.25);
\clip (7.5,1.1) ellipse (1 and 1.25);
\draw (7.5,-1.1) ellipse (1 and 1.25);
\fill[white] (7.5,-1.1) ellipse (1 and 1.25);
\end{scope}
\end{tikzpicture}
\end{document}


An answer with fillbetweewn library (useful in many other cases):

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepgfplotslibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
\fill[blue] (7.5,0) ellipse (1 and .75);
\draw (7.5,0) ellipse (1 and .75);
\begin{scope}
\clip (7.5,-.9) ellipse (1 and 1.25);
\path[draw,name path= A](7.5,1.1) ellipse (1 and 1.25);
\clip (7.5,1.1) ellipse (1 and 1.25);
\path[draw,name path=B] (7.5,-1.1) ellipse (1 and 1.25);
\fill [white,
intersection segments={
of=A and B,
sequence={A1--B1}
}];
\end{scope}
\end{tikzpicture}
\end{document}


With even odd rule it is a two-liner. (I would strongly advise against filling some area white because if you use this on top of any background, you will regret it.)
\documentclass[tikz,border=3.14mm]{standalone}