\documentclass{article}

\usepackage{pgfplots}

\usepackage{pgfplots.assert}


\begin{document}

Compute normal UT

\makeatletter
%\tracingmacros=2 \tracingcommands=2
\def\runTest#1{
	\message{RUNNING '#1'...^^J}%
	\pgfplotsgetnormalforcurrentview
	%
	\pgfplotsmathvectorfromstring{\pgfplots@view@dir@threedim}{pgfbasic}
	\message{COMPARING \expected == \pgfplotsretval...^^J}%
	\pgfplotsmathvectorcompwise{\expected}{\pgfplotsretval}{equal}{pgfbasic}%
	%
	\pgfplotsassertequalstok{1,1,1}{\pgfplotsretval}{(compared expected normal \expected\space with actual \pgfplots@view@dir@threedim)}%
	\message{finished '#1'.^^J}%
}

% CASE: 
%
%   ^
%   | |---|
%   y |   |
%     |---|
%       x->
\pgf@xx=1pt
\pgf@xy=0pt

\pgf@yx=0pt
\pgf@yy=1pt

\pgf@zx=0pt
\pgf@zy=0pt

\def\expected{0,0,-1}%

\runTest{X-Y}



% CASE: 
%
%   ^
%   | |---|
%   z |   |
%     |---|
%       x->
\pgf@xx=1pt
\pgf@xy=0pt

\pgf@yx=0pt
\pgf@yy=0pt

\pgf@zx=0pt
\pgf@zy=1pt

\def\expected{0,1,0}%

\runTest{X-Z}




% CASE: 
%
%   ^
%   | |---|
%   z |   |
%     |---|
%       y->
\pgf@xx=0pt
\pgf@xy=0pt

\pgf@yx=1pt
\pgf@yy=0pt

\pgf@zx=0pt
\pgf@zy=1pt

\def\expected{-1,0,0}%

\runTest{Y-Z}


\pgfplotsset{
		separate axis lines,
		every outer x axis line/.append style= {-stealth},
		every outer y axis line/.append style= {-stealth},
		every outer z axis line/.append style= {-stealth},
		samples=15,shader=interp,title={view=\h,\v},
		domain=-3:3,
		enlargelimits=false,
		view=\h\v,xlabel=x,ylabel=y,
		extra description/.code={%
			\node[draw,fill=white] at (axis cs:0,0,0) {};
		},
}

\def\TESTPLOT{
	\addplot3[surf,id=unittest_getnormal_gnuplot] gnuplot {exp(0-x**2-y**2)/0.001};
}

\def\v{30}
\foreach \h in {0,30,90,120,210,300} {
\message{VIEW={\h}{\v}^^J}
\begin{tikzpicture}
	\begin{axis}
	\TESTPLOT
	\end{axis}
\end{tikzpicture}

}

\def\v{-30}
\foreach \h in {0,30,90,120,210,300} {
\message{VIEW={\h}{\v}^^J}
\begin{tikzpicture}
	\begin{axis}
	\TESTPLOT
	\end{axis}
\end{tikzpicture}

}

\foreach \h/\v in {0/0,0/90,90/0} {
\message{VIEW={\h}{\v}^^J}
\begin{tikzpicture}
	\begin{axis}
	\TESTPLOT
	\end{axis}
\end{tikzpicture}

}
\end{document}

