# How to crop shapes in Tikz

I found a nice solution to draw explosions using Tikz (TiKZ: "hand-drawn" explosion)

However, I need only the superior half part of this shape. How do I crop out the bottom part?

Here is some code of my drawing, The objective is to gat an explosion at the bottom of the well.

\begin{tikzpicture}
%-> DRAW THE EXPLOSION
\node[starburst, draw, minimum width=0.3cm, minimum height=0.4cm, red, fill=orange] at (0,0) {};

%-> DEFINE THE FUNCTIONS OF THE PARABOLAS
\def\v0{7.5}
\def\fcn#1{tan(#1)*abs(\x) - 9.8*(\x)^2/(2*(\v0*cos(#1))^2)}
\def\Fcn{(\v0)^2/19.6 - 9.8*(\x)^2/(2*(\v0)^2)}
\def\xrange#1{(\v0)^2*sin(2*#1)/9.8}

%-> DRAW THE WELL
\def\well#1{
\foreach \x in {#1}
\fill[gray!25,opacity=0.25]
({-#1},{\Fcn}) rectangle({-\xrange{45}},0)
({#1},{\Fcn}) rectangle({\xrange{45}},0)
;
\foreach \x in {#1}
\draw[gray]
({-#1},0)--
({-#1},{\Fcn})--
({-\xrange{45}},{\Fcn})
({#1},0)--
({#1},{\Fcn})--
({\xrange{45}},{\Fcn})
;
}

%-> DRAW THE PARABOLAS
\def\myplot#1#2{
\draw[samples=100,domain=-\xrange{#1}:\xrange{#1},#2]
plot (\x, {\fcn{#1}});
}
\myplot{75}{dotted,gray}
\myplot{60}{dotted,gray}
\myplot{45}{dash dot,gray}
\myplot{30}{dashed,gray}
\myplot{15}{dashed,gray}
\draw[thick,domain=-\xrange{45}:\xrange{45}]
plot (\x, {\Fcn});

%-> DRAW THE AXIS
%... horizontal
\draw[->, very thick]
({-\xrange{45}-0.5},0)--
({\xrange{45}+0.5},0) node[below]{$x$}
;
%... vertical
\draw[->, very thick]
(0,0)--
(0,{\xrange{45}/2+0.5}) node[left]{$y$}
;

%-> DRAW THE NODES
\draw
({-\wellrad},0) node[below]{$-R$}
(0,0) node[below]{0}
({\wellrad},0) node[below]{$R$}
;
\draw[<->, very thick]
({-\xrange{45}-0.2},0)--
({-\xrange{45}-0.2},{\Fcn}) node[midway, left]{$h$}
;
\end{tikzpicture}

• check out TikZ's crop environment. – A.Ellett Oct 13 '18 at 18:26
• @marmot Indeed I meant clip, not crop. Sigh. Thank you for the correction. – A.Ellett Oct 13 '18 at 18:38

You could just clip the star burst.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}
%-> DRAW THE EXPLOSION
\begin{scope}
\clip (-2,0) rectangle (2,2);
\node[starburst, draw, minimum width=0.3cm, minimum height=0.4cm, red, fill=orange] at (0,0) {};
\end{scope}

%-> DEFINE THE FUNCTIONS OF THE PARABOLAS
\def\v0{7.5}
\def\fcn#1{tan(#1)*abs(\x) - 9.8*(\x)^2/(2*(\v0*cos(#1))^2)}
\def\Fcn{(\v0)^2/19.6 - 9.8*(\x)^2/(2*(\v0)^2)}
\def\xrange#1{(\v0)^2*sin(2*#1)/9.8}

%-> DRAW THE WELL
\def\well#1{
\foreach \x in {#1}
\fill[gray!25,opacity=0.25]
({-#1},{\Fcn}) rectangle({-\xrange{45}},0)
({#1},{\Fcn}) rectangle({\xrange{45}},0)
;
\foreach \x in {#1}
\draw[gray]
({-#1},0)--
({-#1},{\Fcn})--
({-\xrange{45}},{\Fcn})
({#1},0)--
({#1},{\Fcn})--
({\xrange{45}},{\Fcn})
;
}

%-> DRAW THE PARABOLAS
\def\myplot#1#2{
\draw[samples=100,domain=-\xrange{#1}:\xrange{#1},#2]
plot (\x, {\fcn{#1}});
}
\myplot{75}{dotted,gray}
\myplot{60}{dotted,gray}
\myplot{45}{dash dot,gray}
\myplot{30}{dashed,gray}
\myplot{15}{dashed,gray}
\draw[thick,domain=-\xrange{45}:\xrange{45}]
plot (\x, {\Fcn});

%-> DRAW THE AXIS
%... horizontal
\draw[->, very thick]
({-\xrange{45}-0.5},0)--
({\xrange{45}+0.5},0) node[below]{$x$}
;
%... vertical
\draw[->, very thick]
(0,0)--
(0,{\xrange{45}/2+0.5}) node[left]{$y$}
;

%-> DRAW THE NODES
\draw
({-\wellrad},0) node[below]{$-R$}
(0,0) node[below]{0}
({\wellrad},0) node[below]{$R$}
;
({-\xrange{45}-0.2},{\Fcn}) node[midway, left]{$h$}

• @Brasil AFAIK clipping does not create extra space. Note that in this application you are absolutely safe because the clipped region is fully contained in the plot. BTW, you can always adjust the bounding box with the \path[use as bounding box] ... syntax, but this is not needed here. – user121799 Oct 13 '18 at 18:44