Based on the following idea by @gernot from How to define new 2D canvas, I want to adapt it so that I can pass 3 existing coordinates to it.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{tikz-3dplot}
% define canvas as origin, x direction, ydirection by specifying each coordinate
\makeatletter
\tikzoption{canvas}[]{\@setOxy#1}
\def\@setOxy (#1,#2,#3),(#4,#5,#6),(#7,#8,#9)%
{\def\tikz@plane@origin{\pgfpointxyz{#1}{#2}{#3}}%
\def\tikz@plane@x{\pgfpointxyz{#4}{#5}{#6}}%
\def\tikz@plane@y{\pgfpointxyz{#7}{#8}{#9}}%
\tikz@canvas@is@plane}
\makeatother
% my adaption attempt
\makeatletter
\tikzoption{canvasP}[]{\@setPOxy#1}
\def\@setPOxy #1,#2,#3%
{\def\tikz@plane@origin{#1}%
\def\tikz@plane@x{#2}%
\def\tikz@plane@y{#3}%
\tikz@canvas@is@plane}
\makeatother
% Define multiple 3d points following tkz-euclide notation
\newcommand{\tkzDefdPoints}[2][]{
\foreach \ptx/\pty/\ptz/\name in {#2}{
\path [#1] (\ptx,\pty,\ptz) coordinate (\name);
}
}
\tdplotsetmaincoords{70}{110}
\begin{document}
\begin{tikzpicture}[tdplot_main_coords]
\draw[->] (0,0,0) -- (5,0,0) node[right]{$x$};
\draw[->] (0,0,0) -- (0,5,0) node[above]{$y$};
\draw[->] (0,0,0) -- (0,0,5) node[below left]{$z$};
\tkzDefdPoints{2/2/2/A,2/3/2/B,2/2/3/C}
\draw (A) -- (B) -- (C) -- cycle;
\begin{scope}[canvas={(2,2,2),(2,3,2),(2,2,3)}]
\draw[red] (1,0) -- (1,1) -- (0,1);
\end{scope}
\begin{scope}[canvasP={A,B,C}]
\draw[blue,dashed] (1,0) -- (1,1) -- (0,1);
\end{scope}
\end{tikzpicture}
\end{document}
While not getting any error message, it still does not do anything. Is there a \pgf... command that can be used on an existing coordinate rather than specifying the point giving the x, y and z coordinates?
I tried a workaround by adapting an other idea by @andrew swann to extract (or rather save) the 3d coordinates of a point but ran into more trouble. Link to seperate question: tikzkeys not working inside foreach statement