0

So i've recently started to practise drawing (orientable) surfaces using TikZ wich resulted in my first figure that looks like this:

enter image description here

Which i am quite proud of, even though it might not be much. However, a few weeks ago i accidentally stumpled upon a few illustrations like this one in partcular

source: http://brickisland.net/cs177/?p=144

(source in picture description added)

and i would really love to know whether this was (possibly) done in TikZ or LaTeX in general and if you guys could give me a few hints on how to learn to create such figures by myself. I know that the TikZ-Manual is a good start but i feel a bit lost and even though i spent almost dozens of hours learning how to draw curved lines in TikZ i only managed to do my first figure mainly by accident to be honest.

To sum it up: Where would be a good start for me to learn how to draw such figures or what exactly would help me start learning this? For example: there are many different ways to draw curved lines. Which approach would help me the most if i wanted to recreate the 2nd figure basically? I am also quite curious on how to manage to do the vertical lines on the surface.

Any advise is highly appreciated.

Thank you very much!

PS: I am by no means looking for someone to recreate the shown figure. I am mainly interested in learning the skills to recreate such things by my own in the future.

closed as off-topic by Henri Menke, Phelype Oleinik, TeXnician, Stefan Pinnow, Sebastiano May 4 '18 at 6:12

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • @marmot i am of course willing to use everything that helps me creating such figures. I've never heard of asymptote before. Please excuse my lack of knowledge regarding the different tools. I am quite new to this stuff. – Zest May 3 '18 at 20:14
  • I think i actually came across a few asymptote graphics if i recall correctly. However, i am in fact really looking to get things done in tikz due to its unique "vector"-look. Maybe that makes my intentions a bit clearer. The 2nd figure just looks so smooth! – Zest May 3 '18 at 20:18
  • that looks really cool indeed! But for now, i am really mostly trying to make my figures like more like the 2nd figure in my opening question. But i am definitely willing to learn asymptote if that's the way to go to create such figures (preferably in the same style as the 2nd figure) – Zest May 3 '18 at 20:36
  • 1
    This link can be a starting point: tex.stackexchange.com/questions/158585/… – Sebastiano May 3 '18 at 20:57
  • 3
    Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are not really on-topic as they usually do not revolve around an abstract issue. Instead, describe the problem and what has been done so far to solve it or, if applicable, ask on Software Recommendations SX. – Henri Menke May 3 '18 at 21:38
6

OK, here we go then. Of course, there is some considerable room for improvement. Why does it look like fake 3D? Well, because it is fake 3D. You'd be better off with asymptote and/or if you find someone with a lot of skill and patience who is willing to help you. ;-)

enter image description here

\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{calc,intersections,fadings} % 
\usetikzlibrary{shadows.blur}
\usepackage{tikz-3dplot}
\begin{document}

\tdplotsetmaincoords{75}{70}
\begin{tikzpicture}[tdplot_main_coords,scale=3.14]

% restore these if you want to see where the axes point
% \draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
% \draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
% \draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};
\begin{scope}[xshift=2mm,rotate=10]
\tikzfading[name=fade right,
            left color=transparent!60,
            right color=transparent!00] ;
\fill[gray!80, blur shadow={shadow blur
steps=10,shadow xshift=0pt,shadow yshift=0pt,shadow scale=1.15}]  plot[variable=\x,samples=180,domain=-90:270]
({1.2*cos(\x)},{sin(\x)},{1});
\filldraw[white,path fading=fade right,overlay] (-1.5,-1.3,1) --  (1.5,-1.3,1) -- 
(1.5,1.3,1) -- (-1.5,1.3,1) -- cycle;
\end{scope}

\draw[name path=back] plot[variable=\x,samples=180,domain=90:270]
({1.2*cos(\x)},{sin(\x)},{1.6-0.4*cos(2*\x)});
\draw[name path=front] plot[variable=\x,samples=180,domain=-90:90]
({1.2*cos(\x)},{sin(\x)},{1.6-0.4*cos(2*\x)}); 
\coordinate (front1) at ({1.2*cos(-45)},{sin(-45)},{1.6-0.4*cos(-2*45)});
\coordinate (front2) at ({1.2*cos(45)},{sin(45)},{1.6-0.4*cos(2*45)});
\coordinate (front3) at ({1.2*cos(0)},{sin(0)},{1.6-0.4*cos(2*0)});
\draw[name path=top,opacity=0.3] plot[variable=\x,samples=180,domain=-90:90]
(0,{sin(\x)},{1.8-0.2*cos(2*\x)});
\coordinate (top1) at (0,{sin(0)},{1.8-0.2*cos(2*0)});
\path[name intersections={of=top and back, by={tb}}];
\draw[name path=top front,opacity=0.3] (front1)  to[out=-10,in=-150] (front2);
\draw[name path=top front,opacity=0.3] (front3)  to[out=100,in=-20] (top1)
to[out=160,in=20] (tb);


%
\fill[blue,opacity=0.2] plot[variable=\x,samples=180,domain=-90:90]
(0,{sin(\x)},{1.8-0.2*cos(2*\x)}) --
plot[variable=\x,samples=180,domain=90:-90]
({1.2*cos(\x)},{sin(\x)},{1.6-0.4*cos(2*\x)});

\fill[blue,opacity=0.2] plot[variable=\x,samples=180,domain=-90:90]
(0,{sin(\x)},{1.8-0.2*cos(2*\x)}) --
plot[variable=\x,samples=180,domain=90:270]
({1.2*cos(\x)},{sin(\x)},{1.6-0.4*cos(2*\x)});


\end{tikzpicture}
\end{document}

EDIT: Added grid lines and made the shadow blurry.

  • this is beautifully done! i will patiently try to learn the general approach you've chosen with the code you provided. thanks a lot for the input! I can't wait to get my hands on it. :-) – Zest May 4 '18 at 7:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.