# How could I draw the projection of a three-dimensional domain of integration onto the xy-plane by TIKZ/PGF

I want to draw the following picture by using TIKZ:

But I do not know how to hatch the projection, that is the two-dimensional domain: ${(x,y,z} \mid z=0, x^2+y^2\leq 4}.$ And I do not know how to draw it fairly precisionly? Can anyone help me? I've draw it by Geogebra, and then convert it into tikz file. But when I compile it by PDFlatex, I could not get the desired result! I do not why it is like this: Maybe someone can tell me why?

According to Lionel MANSUY's sugestion, I construct it as follows:

    %compile it by pdflatex
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,trees}
\usetikzlibrary{shapes,backgrounds,calc,intersections,patterns}

\begin{document}
\begin{tikzpicture}[scale=2]
\draw[very thin,gray,opacity=.3](-3,-3)grid (4,4);

\draw[pattern=north east lines,name path=bottom](0,0) ellipse (2 and .6); %draw the projection onto xy-plane, then hatch it by north east lines

\draw[fill=white,name path=ellipse](0,2) ellipse (2 and .5);%draw top disc

\draw[name path=line,dotted,thick,green](-2,2)--(2,2);

\fill[red,opacity=.5,name intersections={of=ellipse and line}]
(intersection-1) circle(1pt)node{.}
(intersection-2)circle(1pt)node{.};
\draw(intersection-1)node[right]{$D$};\draw(intersection-2)node[left]{$E$};
\filldraw[fill=white,name path=lateral](intersection-2)..controls (-1,0) and (-1/2,0)..(0,0)..controls(1/2,0) and (1,0)..(intersection-1);
\draw[fill=white](0,2) ellipse (2 and .5);
\draw[dotted,thick](-2,2)--(2,2);
\fill[blue,opacity=.5,name intersections={name=intersection-second,of=lateral and bottom}](intersection-second-1)circle(1pt)node{.} (intersection-second-2)circle(1pt)node{.};
\draw (intersection-second-1)node[left]{$A$};
\draw(intersection-second-2)node[right]{$B$};
\draw[->](2,0)--(3,0)node[below]{$y$};
\draw(-3,0)--(-2,0);
\draw[->](0,2)--(0,3)node[left]{$z$};
\path[name path=yy](0,0)--(-3,-3);
\draw[->,name intersections={name=intersection-third,of=bottom and yy}](intersection-third-1)node[anchor=north west]{$C$}--(-2,-2)node[right]{$x$};
\fill[blue,opacity=.5](intersection-third-1)circle(1pt)node{.};
\draw[dashed](-2,0)--(-2,2);
\path[name path=zz](0,1/2)--(0,3);
\draw[name intersections={name=yz,of=zz and ellipse}](yz-2)--(0,2);
\path[name path=lineup](0,2)--+(45:3);
\path[name path=linedown](0,2)--+(45:-1);
\draw[dotted,thick,name intersections={name=up,of=lineup and ellipse},name intersections={name=down,of=linedown and ellipse}](up-1)--(down-1);
\draw(0,2)node[red,above left]{\tiny$(0,2)$};
\fill[opacity=.5](0,2)circle(1pt)node{.};
\draw[->](1,1)--(1.8,1)node[right]{$\displaystyle z=\frac{x^2+y^2}{2}$};

\end{tikzpicture}
\end{document}


And the result picture is here:

Can we draw this picture fairly precisionly by using tikz?

-
I don't know if it will help but can you post the code that Geogebra exported? – hpesoj626 Dec 13 '12 at 7:29
Just out of curiosity, just what are the points A and B there for? Does the reflector intersect the ellipse at A and B? Seems like the case in your code. It looks to me also like the reflector has a flat vertex. :) – hpesoj626 Dec 13 '12 at 8:11
Good job :-) What do you mean by "fairly precisionly" ? – Lionel MANSUY Dec 13 '12 at 8:12
For the lateral surface, I personally would use something like this: \fill[white] (-2,2) parabola[parabola height=-2cm] (2,2) --cycle; \draw (-2,2) parabola[parabola height=-2cm] (2,2); – Lionel MANSUY Dec 13 '12 at 8:25
You could also have a look at the pgfplots package, that can also be used to draw 3D plots – Lionel MANSUY Dec 13 '12 at 8:27