Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to draw the following picture in tikz but I can't make it. enter image description here

Any suggestions on how this can be done in TikZ or somewhere else?

share|improve this question
4  
Welcome to TeX.sx! On this site, a question should typically revolve around an abstract issue (e.g. "How do I get a double horizontal line in a table?") rather than a concrete application (e.g. "How do I make this table?"). Questions that look like "Please do this complicated thing for me" tend to get closed because they are "too localized". Please try to make your question clear and simple by giving a minimal working example (MWE): you'll stand a greater chance of getting help. –  Marco Daniel Mar 31 '13 at 15:22
1  
The most difficult portion of this would probably be the curves; I would search this site for the components of the problem you face and then put the pieces together yourself. You'll learn the package much more effectively that way. –  Sean Allred Mar 31 '13 at 15:43
add comment

3 Answers

I agree with Sean Allred's comment. The figure is not complex, except perhaps for the curved surfaces. So, to get you started, here is a possible solution for that part:

\def\surface{
\draw (surface center)
  ++(-2,-1) to[out=20,in=-170] ++(4,0.2) --
  ++(1,0.7) to[out=190,in=15] ++(-4,-0.3) --
  cycle;
}

\begin{tikzpicture}
\coordinate (surface center) at (0,0.7);
\surface
\coordinate (surface center) at (0,-0.7);
\surface
\end{tikzpicture}

Result

Some explanations:

  • Since the surface has to be drawn two times, I defined a macro to do that drawing.
  • To allow for the shape to be drawn at different positions, you have two approaches:
    1. To use absolute coordinates for the corners, and enclose the drawing in a scope which performs some shifts to place it at the appropiate position.
    2. To use relative coordinates for the corners. I followed this approach. You have to first define the coordinate surface center, and the rest of the corners are relative to this one.
  • For the curved edges I used the to operator, which allows you to specify the angle at which the curve leaves (out) and enters (in) its ends.

Update

If hidden parts of the lines have to be visually different, the easiest approach is to draw the surfaces filled in white, with 80% of opacity, like in the following proof of concept:

\def\surface{
\draw[fill=white, fill opacity=.70] (surface center)
  ++(-2,-1) to[out=20,in=-170] ++(4,0.2) --
  ++(1,0.7) to[out=190,in=15] ++(-4,-0.3) --
  cycle;
}

\begin{tikzpicture}
\coordinate (surface center) at (0,-0.7);
\surface
\draw[->] (0.5, -1.2) -- +(0, 1.5);
\coordinate (surface center) at (0,0.7);
\surface
\end{tikzpicture}

Result

share|improve this answer
    
The difficult part is to find out which parts of a line are hidden (dashed). –  g.kov Mar 31 '13 at 19:14
    
Oh, I did noticed that there were dashed parts. However, if instead of dahsing line a gray color is allowed, then the solution is simple. You draw the top surface in white with 50% transparency, over the arrows. –  JLDiaz Mar 31 '13 at 19:19
    
@g.kov See my updated answer. –  JLDiaz Mar 31 '13 at 19:26
    
Yes, this one looks OK, but the other lines have two visible segments. –  g.kov Mar 31 '13 at 20:46
add comment

With PSTricks.

enter image description here

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node}
\newcommand\surface[4][]{%
    \pnode(2,0.75){#2}
    \pnode(5,1.25){#3}
    \pscustom[linejoin=1,#1]
    {
        \psline(1,2)(0,0)
        \pscurve(2,0.25)(4,-0.25)(6,0)
        \psline(7,2)
        \pscurve(5,1.75)(3,2.25)(1,2)
        \closepath
    }
    \rput(1,0.5){$\displaystyle#4$}%
}
\begin{document}
\begin{pspicture}(7,5.5)
    \rput(0,3){\surface{A}{B}{}}
    \rput(0,0.5){\surface{C}{D}{\Sigma_f}}
    \pcline[linestyle=dashed](D)(B)
    \pcline{->}(C)(A)\naput[npos=0.675,labelsep=0pt]{$N_n^0$}
    \pcline{->}(C)(B)\nbput[npos=0.4,labelsep=0pt]{$f^0$}
    \pcline{->}(C)(D)\nbput[labelsep=0pt]{$N^0$}
    \rput(0,3){\surface[fillstyle=solid,fillcolor=yellow,opacity=0.75]{A}{B}{\Sigma_{f+\Delta f}}}
\end{pspicture}
\end{document}
share|improve this answer
add comment

enter image description here

This is not a fake sketch, but a real projection of 3D surfaces, made with Asymptote. Key points here:

  • each surface is represented as a bicubic Bezier patch with 16 control points;

  • to make interception easier, horizontal line AB is oriented such that vertical projections of both A and B cross the same curves on both surfaces;

  • intersection points of the lines and surface edge and the surface itself are calculated explicitly.

  • label names, positions and relative positions are collected in arrays.

bpatch.asy:

import graph3;
size(300);
size3(100,40,50,IgnoreAspect);

currentprojection=orthographic(camera=(5,-4,12), up=(0,0,1), target=(6,6,4.5), zoom=1);

triple bCurve(real t,triple a,triple b,triple c,triple d){
  return a*(1-t)^3+3b*(1-t)^2*t+3c*(1-t)*t^2+d*t^3;
}

guide3 uCurve(real u,triple[][] p){
  triple a,b,c,d;
  a=bCurve(u,p[0][0],p[0][1],p[0][2],p[0][3]);
  b=bCurve(u,p[1][0],p[1][1],p[1][2],p[1][3]);
  c=bCurve(u,p[2][0],p[2][1],p[2][2],p[2][3]);
  d=bCurve(u,p[3][0],p[3][1],p[3][2],p[3][3]);
  return a..controls b and c ..d;
};

guide3 vCurve(real v,triple[][] p){
  triple a,b,c,d;
  a=bCurve(v,p[0][0],p[1][0],p[2][0],p[3][0]);
  b=bCurve(v,p[0][1],p[1][1],p[2][1],p[3][1]);
  c=bCurve(v,p[0][2],p[1][2],p[2][2],p[3][2]);
  d=bCurve(v,p[0][3],p[1][3],p[2][3],p[3][3]);
  return a..controls b and c ..d;
};

triple bPatch(real u, real v, triple[][] p){
  triple a,b,c,d;
  a=bCurve(u,p[0][0],p[0][1],p[0][2],p[0][3]);
  b=bCurve(u,p[1][0],p[1][1],p[1][2],p[1][3]);
  c=bCurve(u,p[2][0],p[2][1],p[2][2],p[2][3]);
  d=bCurve(u,p[3][0],p[3][1],p[3][2],p[3][3]);
  return bCurve(v,a,b,c,d);
}

triple[][] p={ // control poits of  bicubic Bezier patch
  {(0,12,0),(4,12,10),(8,12,6),(12,12,6)},
  {(0, 8,0),(4, 8,10),(8, 8,6),(12, 8,1.5)},
  {(0, 4,0),(4, 4,10),(8, 4,6),(12, 4,5)},
  {(0, 0,0),(4, 0,10),(8, 0,6),(12, 0,5)},
};


real w=1.2pt;

transform3 t=shift(0,0,14); // shift up

guide[] g={
  project(uCurve(0,p)),
  project(uCurve(1,p)),
  project(vCurve(0,p)),
  project(vCurve(1,p)),

  project(t*uCurve(0,p)),
  project(t*uCurve(1,p)),
  project(t*vCurve(0,p)),
  project(t*vCurve(1,p)),
};

// edge curves of the bottom patch
draw(g[0],red+w);
draw(g[1],green+w);
draw(g[2],blue+w);
draw(g[3],orange+w);

// edge curves of the top patch
draw(g[4],red+w);
draw(g[5],green+w);
draw(g[6],blue+w);
draw(g[7],orange+w);

real u=0.6, v=0.25;
draw(project(vCurve(v,p)),green+w);
draw(project(t*vCurve(v,p)),green+w);


triple A,B,C,D,Q,R;
A=bPatch(u,v,p);
B=t*A; 
Q=bPatch(u+0.3,v,p);
C=(Q.x,Q.y,A.z);
D=t*C;

pair Ap,Bp,Cp,Dp,Rp;
Ap=project(A);
Bp=project(B);
Cp=project(C);
Dp=project(D);

draw((Ap--Cp),darkblue+1.2pt,Arrow(size=5pt));

pair xAB=intersectionpoint(project(t*vCurve(1,p)), (Ap--Bp));
pair xCD=intersectionpoint(project(t*vCurve(1,p)), (Cp--Dp));
pair xCD2=intersectionpoint(project(t*vCurve(v,p)), (Cp--Dp));
pair xAD=intersectionpoint(project(t*vCurve(1,p)), (Ap--Dp));
pair xAD2=intersectionpoint(project(t*vCurve(v,p)), (Ap--Dp));

pen dashed=linetype(new real[] {4,3}); // set up dashed pattern

pen linePen=darkblue+1.2pt;

draw((Ap--xAB),linePen);
draw((xAB--Bp),darkblue+dashed+1.2pt,Arrow(size=5pt));

draw((Cp--xCD),linePen);
draw((xCD--xCD2),darkblue+dashed+1.2pt);
draw((xCD2--Dp),linePen);

draw((Ap--xAD),linePen);
draw((xAD--xAD2),darkblue+dashed+1.2pt);
draw((xAD2--Dp),linePen,Arrow(size=5pt));

draw((Bp--Dp),linePen,Arrow(size=5pt));

string[] L={
  "\Sigma_t",
  "\Sigma_{t+\Delta  t}",
  "Nn^\alpha",
  "N^\alpha",
  "t^\alpha",
};

pair O=N-N;
pair[] relPos={O,O,W,S,SE};

pair[] Pos={
  project(bPatch(0.7u,1.4v,p)),
  project(t*bPatch(0.7u,1.4v,p)),
  point(Ap--Bp,0.4),  
  point(Ap--Cp,0.5),  
  point(Ap--Dp,0.5),  
};

for(int i=0;i<L.length;++i){
  label("$"+L[i]+"$",Pos[i],relPos[i]);
}

dotfactor=5;
dot(Ap,linePen,UnFill);

pen fillPen=lightblue+opacity(0.2);
fill(g[0]--g[1]--g[2]--g[3]--cycle,fillPen);
fill(g[4]--g[5]--g[6]--g[7]--cycle,fillPen);

To process, run asy -f pdf bpatch.asy

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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