# Drawing an algebraic space curve with LaTeX (TikZ, PSTricks, other)

I need to include in a paper a drawing of a "non trivial" algebraic curve.

I have found (with Google) the following example:

x^2 + y^2 + z^2 + 8)^2 - 36 (x^2 + y^2) = 0
y^2 + (z - 2)^2 - 4 = 0
-4 <= x <= 4
-4 <= y <= 4
-2 <= z <= 2


Is it possible to have a nice representation of this curve with LaTeX?

Here is a drawing of this curve:

PS: If you know other nice space algebraic curves that might be easier to draw, I would also be interested.

• why not simply include the image? Someone will no doubt take up the challenge to write it in tikz but what do you gain? Nov 15, 2020 at 10:20
• With LaTeX, I could have more control on the drawing and be able to produce something more beautiful Nov 15, 2020 at 10:22
• Look at here.
– user213378
Nov 26, 2020 at 0:52

The pstricks package pst-3dplot has a \parametricplotThreeD command for space curves. Here is, as an example, Viviani's curve (intersection of a sphere and a cylinder tangent to the sphere and passing through its centre):

\documentclass[svgnames, border=6pt]{standalone}
\usepackage[T1]{fontenc}
\usepackage{pst-3dplot, pst-math}
\def\R{4}

\begin{document}

\psset{xPlotpoints = 500, plotstyle=curve, algebraic, arrowinset=0.2, labelsep=3pt}
\begin{pspicture}(-4.5,-4)(3.5,4.5)
\psset{linewidth=0.6pt}
\pstThreeDCoor[zMax=5, yMax=4, xMax=5.5, linecolor=LightSteelBlue]
\pstThreeDDot(0,0,0)
\psset{linewidth=1.5pt, linecolor=Coral}
\parametricplotThreeD(-\pstPI2, \pstPI2){\R*(cos(t))^2|\R*sin(2*t)/2|\R*sin(t)}
\psset{border=1pt}
\parametricplotThreeD(-\pstPI1, -\pstPI2){\R*(cos(t))^2|\R*sin(2*t)/2|\R*sin(t)}
\parametricplotThreeD(\pstPI2,\pstPI1){\R*(cos(t))^2|\R*sin(2*t)/2|\R*sin(t)}
\pstThreeDLine[linecolor=LightSteelBlue, linewidth=0.8pt](0,0,3)(0,0,4.5)
\end{pspicture}

\end{document}