[Tex/LaTex] Defining a function inside tikz enviroment

tikz-pgf

I would like to define a simple function inside tikz environment to help me drawing a plane. I found this thread, but I could not reproduce the proposed solution to fulfill my needs. Example code is:

\documentclass[12pt,a4paper,oneside]{report}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14} 

\begin{document}
\begin{tikzpicture}[
%
declare function = {
plane(\x, \y) = - \x - \y + 3;
},
%
]

\draw[blue]  (0,0,{plane(0,0)});

\end{tikzpicture}
\end{document}

Is it possible to use declare function in the attempt way? If so, how can I do this?

ps.: I would not like to use pgfplot for this! 🙂

Best Answer

Note the variables with no whitespaces in the definition.

\begin{tikzpicture}[declare function = {plane(\x,\y) = - \x - \y + 3;}]
\draw[blue]  (1,1) -- (0,0,{plane(0,0)});
\node at (0,0,3) {0,0,3};
\end{tikzpicture}

enter image description here

Make your peace with the excessive whitespace usage :)