1

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}

enter image description here

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.

enter image description here

  • 1
    What don't you like about 3D tools? You seem to be asking how to do something of type X without using tools designed for doing things of type X. If you just didn't like tikz-3dplot it would be different .... – cfr Mar 19 '24 at 04:39

1 Answers1

0

I use Maple to find coordinates of two points P and Q. About the circle CDP, I use 3dtools! Therefore, I don't add that code.

\documentclass[border=3mm,12pt,tikz]{standalone}
\usepackage{tikz,tikz-3dplot} 
\begin{document}
    \tdplotsetmaincoords{60}{110}
    \begin{tikzpicture}[tdplot_main_coords]
        \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)                
({\h*\h*\a/(\a*\a +\b*\b + \h*\h)}, {\h*\h*\b/(\a*\a +\b*\b + \h*\h)}, {\h*(\a*\a +\b*\b)/(\a*\a +\b*\b + \h*\h)}) coordinate (P)

(0, {\h\h\b/(\b\b + \h\h)}, {\h\b\b/(\b\b + \h\h)}) coordinate (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)-- (P) (A)-- (Q) ; \foreach \point/\position in {A/left,B/left,C/below,S/above,D/right,P/right,Q/right} { \fill (\point) circle (.8pt); \node[\position=3pt] at (\point) {$\point$}; } \end{tikzpicture} \end{document}

enter image description here

enter image description here