Anonymous 1123
I see [this answer](https://topanswers.xyz/tex?q=1223#a1456) to write this code. I can not get correct result. How can I repair it?

\documentclass[border=2mm,12pt,tikz]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{calc}
\makeatletter
\pgfmathdeclarefunction{tddistance}{2}{%
\begingroup%
\pgfmathparse{%
sqrt(({#1}[0]-{#2}[0])*({#1}[0]-{#2}[0])+({#1}[1]-{#2}[1])*({#1}[1]-{#2}[1])+({#1}[2]-{#2}[2])*({#1}[2]-{#2}[2]))}%
\pgfmathsmuggle\pgfmathresult\endgroup%
}%
\makeatother
\tikzset{coorf/.style={insert path={({{#1}[0],{#1}[1],{#1}[2]})}}}
\begin{document}
\tdplotsetmaincoords{60}{70}
\begin{tikzpicture}[tdplot_main_coords,
declare function={a=1;xA=7*a;yA=0;zA=0;xB=65*a/14;yB=15* sqrt(3)*a/14;zB=0;xC=0;yC=0;zC=5*a; O={0,0,0};A={xA,yA,zA}; B={xB,yB,zB};C={xC,yC,zC};T={({-((-xC*xC*yB*zA +xB*xB*yC*zA + yB*yB* yC* zA - yB* yC*yC* zA + xC*xC* yA* zB - xA*xA *yC* zB - yA*yA* yC *zB + yA* yC*yC *zB - yC* zA*zA *zB + yC *zA* zB*zB -  xB*xB* yA* zC + xA*xA *yB* zC + yA*yA *yB* zC - yA *yB*yB* zC + yB* zA*zA *zC -  yA *zB*zB* zC - yB* zA* zC*zC +  yA* zB* zC*zC)/(2* (xC* yB* zA - xB* yC* zA - xC* yA *zB + xA* yC *zB + xB *yA* zC - xA* yB* zC)))},{ -((-xB*xB* xC* zA + xB* xC*xC* zA - xC* yB*yB* zA + xB* yC*yC* zA + xA*xA *xC* zB - xA* xC*xC *zB + xC* yA*yA *zB - xA* yC*yC* zB + xC *zA*zA *zB - xC *zA* zB*zB - xA*xA* xB* zC + xA*xB*xB* zC -  xB* yA*yA* zC + xA* yB*yB* zC - xB* zA*zA* zC + xA* zB*zB *zC + xB*zA *zC*zC -  xA* zB* zC*zC)/(2 *(xC* yB* zA - xB* yC* zA - xC* yA* zB + xA *yC*zB + xB* yA* zC - xA* yB* zC)))}, {-((xB*xB* xC* yA - xB* xC*xC *yA - xA*xA *xC*yB + xA* xC*xC* yB - xC* yA*yA* yB + xC* yA* yB*yB + xA*xA *xB*yC -  xA*xB*xB *yC + xB *yA*yA* yC - xA* yB*yB* yC - xB*yA* yC*yC + xA *yB* yC*yC - xC* yB *zA*zA + xB* yC *zA*zA + xC* yA *zB*zB - xA *yC* zB*zB - xB *yA *zC*zC +  xA* yB* zC*zC)/(2* (xC* yB* zA - xB* yC* zA - xC* yA* zB + xA* yC *zB +  xB* yA* zC - xA* yB* zC)))})}};]
\path
[coorf=O] coordinate (O)
[coorf=T] coordinate (T)
[coorf=A] coordinate (A)
[coorf=B] coordinate (B)
[coorf=C] coordinate (C)
;
\pgfmathsetmacro{\R}{tddistance("O","T")};
\begin{scope}[tdplot_screen_coords]
\end{scope}
\foreach \p in {O,T}
{\draw[fill=black] (\p) circle (1.5pt);}
\foreach \p/\g in {O/90,T/90,A/90,B/90,C/90}
{\path (\p)+(\g:3mm) node{$\p$}; }
\end{tikzpicture}
\end{document}


user 3.14159
The problem is the T function. There were additionnal round brackets and additional braces. Fixing this yields

\documentclass[border=2mm,12pt,tikz]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{calc}
\makeatletter
\pgfmathdeclarefunction{tddistance}{2}{%
\begingroup%
\pgfmathparse{%
sqrt(({#1}[0]-{#2}[0])*({#1}[0]-{#2}[0])+({#1}[1]-{#2}[1])*({#1}[1]-{#2}[1])+({#1}[2]-{#2}[2])*({#1}[2]-{#2}[2]))}%
\pgfmathsmuggle\pgfmathresult\endgroup%
}%
\makeatother
\tikzset{coorf/.style={insert path={({{#1}[0],{#1}[1],{#1}[2]})}}}
\begin{document}
\tdplotsetmaincoords{60}{70}
\begin{tikzpicture}[tdplot_main_coords,
declare function={a=1;xA=7*a;yA=0;zA=0;xB=65*a/14;
yB=15*sqrt(3)*a/14;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ope}[tdplot_screen_coords]
\end{scope}
\foreach \p in {O,T}
{\draw[fill=black] (\p) circle (1.5pt);}
\foreach \p/\g in {O/90,T/90,A/90,B/90,C/90}
{\path (\p)+(\g:3mm) node{$\p$}; }
\end{tikzpicture}
\end{document}

![Screen Shot 2020-09-10 at 10.09.31 AM.png](/image?hash=6339393b15825e9b510ff4edc6067322ac397fb42981a1375083f1340c92ea88)