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 a paraboloid using the following code:

\documentclass[border=5mm]{standalone}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}[scale=1,yscale=.5]

\draw (0,0) arc (180:0:2);
\draw ({2-sqrt(3)},1) arc (180:0:{sqrt(3)});
\draw ({2-sqrt(2)},2) arc (180:0:{sqrt(2)});
\draw (1,3) arc (180:0:1);

\draw (0,0) arc (-180:0:2);
\draw ({2-sqrt(3)},1) arc (-180:0:{sqrt(3)});
\draw ({2-sqrt(2)},2) arc (-180:0:{sqrt(2)});
\draw (1,3) arc (-180:0:1);

\draw (0,0) parabola bend (2,4) (4,0);
\draw ({2-sqrt(2)},{-sqrt(2)}) parabola bend (2,4) ({2+sqrt(2)},{sqrt(2)});

\draw ({2-sqrt(2)},{-sqrt(2)}) node [below] {0};
\draw [->]({2-sqrt(2)},{-sqrt(2)}) --++ (5,5);
\draw ({2-sqrt(2)},{-sqrt(2)}) --++ (-2,-2);
\draw [->]({2-sqrt(2)},{-sqrt(2)}) --++ (-3,3);
\draw ({2-sqrt(2)},{-sqrt(2)}) --++ (3,-3);

\end{tikzpicture}

\end{document}

Below is the result:

enter image description here

However, I cannot figure out how to draw the outline of the paraboloid. I also need to colour each horizontal band.

Or, is there a better way to do this?

share|improve this question
    
May be you could use tikz-3dplot package. –  Manuel Jan 31 at 21:31
    
You can't use PGFPlots? tex.stackexchange.com/questions/19921/… –  juliohm Jan 31 at 23:46
add comment

1 Answer

up vote 4 down vote accepted

Not an elegant solution at all, but finally managed it:

\documentclass[border=3mm]{standalone}

\usepackage{tikz,amsmath}
\usetikzlibrary{calc,shapes.geometric}

\begin{document}

\begin{tikzpicture}[scale=1,yscale=.5]

\fill [even odd rule, blue, opacity=0.3] ({-sqrt(2)},{-sqrt(2)-2}) rectangle ({6-sqrt(2)},{-sqrt(2)+6.5}) ({2-sqrt(4-1/4)},{1/2}) parabola bend (2,{4+1/4}) ({2+sqrt(4-1/4)},{1/2}) arc ({asin(1/2/2)}:{-180-asin(1/2/2)}:2);  

\draw [dashed] ({2-sqrt(4-1/4)},{1/2}) arc ({180-asin(1/2/2)}:{asin(1/2/2)}:2);
\draw [dashed] (2,4) -- (2,0);
\draw [->]({2-sqrt(2)},{-sqrt(2)}) --++ (4,4);
\draw (2,0) ++ (-2pt,2pt) --++ (4pt,-4pt);
\draw ({2+sqrt(2)},{sqrt(2)}) ++ (-2pt,2pt) --++ (4pt,-4pt);

\filldraw [draw=blue!85!black, fill=lime, opacity=.4] ({2-sqrt(3-1/4)},{1+1/2}) parabola bend (2,{4+1/4}) ({2-sqrt(4-1/4)},{1/2}) arc ({-180-asin(1/2/2)}:{asin(1/2/2)}:2) ({2+sqrt(4-1/4)},{1/2}) parabola bend (2,{4+1/4}) ({2+sqrt(3-1/4)},{1+1/2}) arc ({asin(1/2/sqrt(3))}:{-180-asin(1/2/sqrt(3))}:{sqrt(3)});
\filldraw [draw=lime!75!black, fill=lime!50!black, opacity=.4] ({2-sqrt(2-1/4)},{2+1/2}) parabola bend (2,{4+1/4}) ({2-sqrt(3-1/4)},{1+1/2}) arc ({-180-asin(1/2/sqrt(3))}:{asin(1/2/sqrt(3))}:{sqrt(3)}) ({2+sqrt(3-1/4)},{1+1/2}) parabola bend (2,{4+1/4}) ({2+sqrt(2-1/4)},{2+1/2}) arc ({asin(1/2/sqrt(2))}:{-180-asin(1/2/sqrt(2))}:{sqrt(2)});
\filldraw [draw=brown!85!black, fill=brown, opacity=.6] ({2-sqrt(1-1/4)},{3+1/2}) parabola bend (2,{4+1/4}) ({2-sqrt(2-1/4)},{2+1/2}) arc ({-180-asin(1/2/sqrt(2))}:{asin(1/2/sqrt(2))}:{sqrt(2)}) ({2+sqrt(2-1/4)},{2+1/2}) parabola bend (2,{4+1/4}) ({2+sqrt(1-1/4)},{3+1/2}) arc ({asin(1/2)}:{-180-asin(1/2)}:1);
\filldraw [draw=brown, fill=brown, opacity=.75] ({2-sqrt(1-1/4)},{3+1/2}) parabola bend (2,{4+1/4}) ({2+sqrt(1-1/4)},{3+1/2}) arc ({asin(1/2)}:{-180-asin(1/2)}:1);

\draw ({2-sqrt(4-1/4)},{1/2}) parabola bend (2,{4+1/4}) ({2+sqrt(4-1/4)},{1/2});
\draw ({2-sqrt(4-1/4)},{1/2}) arc ({-180-asin(1/2/2)}:{asin(1/2/2)}:2);

\node[draw=black, star, fill=yellow,star point ratio=2.25, inner sep=0pt, minimum width=3mm] at (2,4) {};

\draw ({2-sqrt(2)},{-sqrt(2)}) --++ (-2,-2);
\draw [->]({2-sqrt(2)},{-sqrt(2)}) --++ (-2,2);
\draw ({2-sqrt(2)},{-sqrt(2)}) --++ (2,-2);
\draw [->]({2-sqrt(2)},{-sqrt(2)-2}) --++ (0,8.5);

\end{tikzpicture}

\end{document}

enter image description here

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.