-2

I want to draw a spring that looks like its covering the surface of a sphere. Something that looks like this: enter image description here

I tried using tkiz3d and the draw command but I just got a swirly thing that couldn't be turned into what I want.

2 Answers 2

8

Something like this?

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\begin{document}
\def\windingnumber{5}
\begin{tikzpicture}
    \begin{axis}[samples y=0,hide axis,no markers,thick,samples=501,%
        xmin=-1,xmax=1,ymin=-1,ymax=1,zmin=-1,zmax=1,
        width=10cm, height=10cm]
        \addplot3+[domain=-1:1]
        (x/sqrt(2),{sqrt(1-x^2)*cos(180*x*\windingnumber)},{sqrt(1-x^2)*sin(180*x*\windingnumber)});
     \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

0
5

A solution with PSTricks.

\documentclass[pstricks,margin=1cm]{standalone}
\usepackage{pst-solides3d}

\begin{document}
\begin{pspicture}[viewpoint=50 20 10 rtp2xyz,Decran=50,linewidth=.4pt](-1,-1)(1,1)
    \defFunction[algebraic]{f}(t){cos(10*t)*cos(t)}{sin(10*t)*cos(t)}{sin(t)}
    \psSolid[object=courbe,range=PiDiv2 neg PiDiv2,function=f,r=0.005]
\end{pspicture}
\end{document}

enter image description here

Other version

\documentclass[pstricks]{standalone}
\usepackage{pst-rubans}

\begin{document}
\begin{pspicture}(-5,-5)(5,5)
\psset{viewpoint=50 20 40,Decran=50,resolution=720,lightsrc=viewpoint}
\psSphericalSpiral[R=4,fillcolor=orange,grid,dPHI=1]
\end{pspicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .