# 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 converted 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

You could arrange the order of your drawings:

1. Draw your hatched surface as an ellipse (circle with a x- and a y-radius)
2. Draw the parabolic curve (filled with white)
3. Draw the top area (filled with white)

Edit: I'm not sure, but I think that the major axis of the ellipse should not be horizontal, but be slightly inclined

Edit2: you should forget Geogebra code and draw your sketch directly with Tikz; you only have simple structure: lines, ellipse and parabol

I think there is no reason to use GeoGebra to plot this simple kind of graphs. I started a new draw and tried to use the more simple and minimalistic code as possible \documentclass[border=4mm]{standalone}
\usepackage{amsmath}
\usepackage{pgfplots}
\usetikzlibrary{arrows, calc, patterns, shapes}
\pgfplotsset{compat=1.15}

\begin{document}
\small

\begin{tikzpicture}

\tikzset{ind arrow/.style = {->, >=stealth, opacity=0.5}}
\tikzstyle{ortho} = [dashed, gray, thin, domain = -4:4]

% Axes
\draw [->] (-3,0) -- (3,0) node [below] {$y$};
\draw [->] (0,-2) -- (0,4) node [right] {$z$};
\draw [->] (0,0) -- (-2,-1) node [below] {$x$};

%Ticks
\foreach \i in {-2,...,2}
{
\draw [thin] (\i,0) -- (\i,-0.05) node [below]{\scriptsize $\i$};
}

%Curves
\draw [pattern=north east lines, samples=101] (0,0) ellipse (2cm and 0.7071cm);
\draw [thick, fill=white, domain=-2:2] plot (\x,{abs(0.5*\x^2)});
\draw [thick] (0,2) ellipse (2cm and 0.7071cm);
\draw [ortho] (-2,0) -- (-2,2) -- (2,2) -- (2,0);

% Texts
\node (TP) [align=center] at (-2,3.5) {Top plane: \\ $z=2$};
\node (LS) [align=center] at (2.5,3) {Lateral surface: \\[1ex] $z=\dfrac{x^2+y^2}{2}$};
\node [align=center] at (2,-1.5) {Hatched--projection: \\ $x^2+y^2=4, z=0$};

% Arrows
\draw [ind arrow, out=-90, in=0] (LS.south) to (1.5,1.125);
\draw [ind arrow, out=0, in=90] (TP.east) to (-0.75,2.25);

\end{tikzpicture}

\end{document}