Let S.ABCD be a pyramid, ABCD is a square, SA perpendicular to the plane (ABCD); P is projection of A on SC, P is projection of A on SD.
Based on the answer, I tried
\documentclass[border=3mm,12pt,tikz]{standalone}
\usepackage{fouriernc}
\usepackage{tikz,tikz-3dplot}
\tikzset{projection of point/.style args={(#1,#2,#3) on line through (#4,#5,#6)
and (#7,#8,#9)}{%
/utils/exec=\pgfmathsetmacro{\myprefactor}{((#1-#4)*(#7-#4)+(#2-#5)*(#8-#5)+(#3-#6)*(#9-#6))/((#7-#4)*(#7-#4)+(#8-#5)*(#8-#5)+(#9-#6)*(#9-#6))},
insert path={%
({#4+\myprefactor*(#7-#4)},{#5+\myprefactor*(#8-#5)},{#6+\myprefactor*(#9-#6)})}
}}
\begin{document}
\tdplotsetmaincoords{70}{110}
%\tdplotsetmaincoords{80}{100}
\begin{tikzpicture}[tdplot_main_coords,scale=1.5]
\pgfmathsetmacro\a{4}
\pgfmathsetmacro\b{4}
\pgfmathsetmacro\h{4}
% definitions
\path
coordinate(A) at (0,0,0)
coordinate (B) at (\a,0,0)
coordinate (C) at (\a,\b,0)
coordinate (D) at (0,\b,0)
coordinate (S) at (0,0,\h)
%coordinate (E) at ($(B)!0.5!(S)$)
coordinate (J) at ($(B)!(A)!(S)$);
\path[projection of point={(0,0,0) on line through (\a,\b,0) and (0,0,\a)}]
coordinate[label=above right:$P$] (P)
[projection of point={(0,0,0) on line through (0,\b,0) and (0,0,\a)}]
coordinate[label=above right:$Q$] (Q)
;
\draw[dashed,thick]
(A) -- (B) (A) -- (C) (D)--(A) (S) -- (A) ;
\draw[thick]
(S) -- (B) -- (C) -- (D) -- cycle (S) -- (C) ;
%\draw[red, thick, dashed] (A)-- ($(B)!(A)!(S)$);
\draw[red, thick, dashed] (A)-- (P) (A)-- (Q) ;
\foreach \point/\position in {A/left,B/left,C/below,S/above,D/right}
{
\fill (\point) circle (.8pt);
\node[\position=3pt] at (\point) {$\point$};
}
\end{tikzpicture}
\end{document}
Is there another way to find projection a point on a line by using TikZ without using 3dtools? and draw the circle passing three points C, D, P.




tikz-3dplotit would be different .... – cfr Mar 19 '24 at 04:39