0

Is it possible to draw a similar kind of diagram in Latex or in other software? enter image description here This picture is there in Differential topology by Guillemin and Pollack. I need to give a similar sort of pictures for the tutorial. I am aware of the basics of Tikz plot.

Any help will be appreciated.

I am pi
  • 103
  • 2
    Hi pi. Could you please show what you have tried so far? –  May 05 '19 at 14:36
  • @JouleV I have done some attempts using https://tex.stackexchange.com/questions/158585/draw-3d-intersecting-surfaces As I am not aware of these kinds of drawing in Tikz I am trying to edit the code. – I am pi May 05 '19 at 14:37
  • I don't think there is any software in TeX's packages to make this easy, but I would suggest you look at asymptote (http://asymptote.sourceforge.net/) or at blender (https://www.blender.org/), both of which would require significant time for you to learn how to use them. – Benjamin McKay May 05 '19 at 14:53
  • @BenjaminMcKay Okay, thanks. I will learn one of them. – I am pi May 05 '19 at 15:15
  • I'm voting to close this question as off-topic because this is ajust-do-it-for-me question. – Raaja_is_at_topanswers.xyz May 05 '19 at 17:42

1 Answers1

0

This is certainly not a complete answer but the purpose is to make it easier to draw stretches of plots, which then can be patched together like e.g. here. If you use asymptote, such patching is not necessary, but with TikZ and other means that do not have a 3d engine it is.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\tikzset{3d stuff/.is family,
3d stuff/.cd,
parse domain/.code args={#1:#2}{\def\xmin{#1}\def\xmax{#2}},
surface segment/.is family,
surface segment/.cd,
x/.initial=0:1, 
y/.initial=0:1,
function/.initial=f,
plane/.initial=0
}
\tikzset{set surface segment/.code=\tikzset{3d stuff/surface segment/.cd,#1},
surface stretch/.style={/utils/exec=
\pgfkeys{/tikz/3d stuff/parse domain/.expanded=\pgfkeysvalueof{/tikz/3d stuff/surface segment/y}}
\edef\ymin{\xmin}
\edef\ymax{\xmax}
\pgfkeys{/tikz/3d stuff/parse domain/.expanded=\pgfkeysvalueof{/tikz/3d stuff/surface segment/x}},
insert path={%
\ifcase\pgfkeysvalueof{/tikz/3d stuff/surface segment/plane} %xy
plot[variable=\x,smooth,domain=\xmin:\xmax] 
 (\x,\ymin,{#1(\x,\ymin)})
-- plot[variable=\y,smooth,domain=\ymin:\ymax] 
 (\xmax,\y,{#1(\xmax,\y)})
--plot[variable=\x,smooth,domain=\xmax:\xmin] 
 (\x,\ymax,{#1(\x,\ymax)})
-- plot[variable=\y,smooth,domain=\ymax:\ymin] 
 (\xmin,\y,{#1(\xmin,\y)})
--cycle
\or%xz
plot[variable=\x,smooth,domain=\xmin:\xmax] 
 (\x,{#1(\x,\ymin)},\ymin)
-- plot[variable=\y,smooth,domain=\ymin:\ymax] 
 (\xmax,{#1(\xmax,\y)},\y)
--plot[variable=\x,smooth,domain=\xmax:\xmin] 
 (\x,{#1(\x,\ymax)},\ymax)
-- plot[variable=\y,smooth,domain=\ymax:\ymin] 
 (\xmin,{#1(\xmin,\y)},\y)
--cycle
\or%yz
plot[variable=\x,smooth,domain=\xmin:\xmax] 
 ({#1(\x,\ymin)},\x,\ymin)
-- plot[variable=\y,smooth,domain=\ymin:\ymax] 
 ({#1(\xmax,\y)},\xmax,\y)
--plot[variable=\x,smooth,domain=\xmax:\xmin] 
 ({#1(\x,\ymax)},\x,\ymax)
-- plot[variable=\y,smooth,domain=\ymax:\ymin] 
 ({#1(\xmin,\y)},\xmin,\y)
--cycle
\fi
}}}
\begin{document}
\tdplotsetmaincoords{60}{150}
\begin{tikzpicture}[tdplot_main_coords,declare function={%
 f(\x,\y)=0.3*sin(deg(\x);
 g(\x,\y)=-3*sin(deg(2.2*\x);}]
 \draw[set surface segment={x=-pi:0,y=0:2},surface stretch=f];
 \draw[set surface segment={x=0:0.2*pi,y=0:2},surface stretch=g];
 \draw[fill=white,fill opacity=0.5,set surface segment={x=0:pi,y=0:2},surface stretch=f];
 \draw[fill=white,fill opacity=0.5,set surface segment={x=-0.2*pi:0,y=0:2},surface stretch=g];
\end{tikzpicture}

\end{document}

enter image description here