How can I draw a 3D cross-section of a 3-torus embedded in 4D Euclidean space?

I found this question and very nice solutions of Mathematica Stack Exchange.

I have a 3D-torus (\mathbf S^1\times\mathbf S^1\times \mathbf S^1) embedded in 4D Euclidean space. How can I draw the cross-section of this $3$-torus cut by a 3D Euclidean space in an arbitrary direction? The equations are:

\begin{align*}
x &amp;= (r + (t + d\cos\,a)\cos\,b)\cos\,c\\
y &amp;= (r + (t + d\cos\,a)\cos\,b)\sin\,c\\
z &amp;= (t + d\cos\,a)\sin\,b\\
w &amp;= d\sin\,a
\end{align*}


where x,y,z,w are the orthogonal coordinates in 4D space, r,t,d are the radii of three circles, and a,b,c denote the angles of the point with respect to the three circles.

I found the question very valuable to be asked here.

• @Bernd Sir, I meant maths equations of torus be there in MathsJX formats of Stack Exchange to insert equations; you edited them back into TEX commands. – Peter Jones Jun 1 '15 at 12:29
• Take a look at the edit history of the question before lodging your complaint. I think you'll agree the edit an improvement. MathJax is not enabled on TeX.SE (or most SE sites, as I understand it). Probably you should edit to get rid of the HTML. However, I would recommend considering alternative tools. I don't think TikZ or pstricks is a good choice for this. TikZ only does 2D. For simple cases, you can fake 3D. But it is fake 3D which is drawn. There are some packages which can help with the calculations. Fake 4D seems too much to ask. – cfr Jan 19 '16 at 1:39
• @cfr I didn't lodge any complaints, Sir. – Peter Jones Jan 29 '16 at 18:52
• I meant your complaint about @Bernd's edit. – cfr Jan 29 '16 at 20:27
• This will require an extensive amount of work to implement in just LaTeX. Some very simple cross-sections will be possible in PGFplots, but arbitrary cross-sections is perhaps a little too much to ask. I think your best bet is to generate the plot in Mathematica (or equivalent) and export them as PDF or PNG. PGFplots then can import the pre-rendered graphic and add nice labels to it. It can even support pre-rendered 3D graphics as described on pp. 66-71. – JP-Ellis Feb 8 '16 at 9:28

1 Answer

Some very simple cross-sections will be possible in PGFplots and PSTricks (though I am not very familiar with the latter); however, arbitrary cross-sections is perhaps out of the league of these packages. In the case of PGFplots, it can handle 3D plots of the form z = f(x,y) quite well, but more complicate surfaces (such as parametric plots) will often lead to certain faces being drawn in the wrong order and thus certain faces which ought to be hidden suddenly go in the foreground.

Probably your best bet with complicated 3D plots is to generate the plot in Mathematica (or equivalent) and export them as PDF or PNG. PGFplots then can import the pre-rendered graphic and then overlay nice axes and labels to it. This is really easy to do with 2D plot, and PGFplots also offers some support for pre-rendered 3D graphics as described in pp. 66-71 of the PGFplots manual.