5

Let SABC be a tetrahedron, SA = c, AB = a, AC = b, SA perpendicular to AB, AB perpendicular to AC, and AC perpendicular to SA. I am trying to find the projection H of the point A on the plane SBC. I tried with two ways.

Firt way. With some calculations, I found that H(({\b^2*\c^2*\a/((\b^2+\c^2)*\a^2+\b^2*\c^2)},{\b*\c^2*\a^2/((\b^2+\c^2)*\a^2+\b^2*\c^2)},{\b^2*\c*\a^2/((\b^2+\c^2)*\a^2+\b^2*\c^2)})).

Second way, We can prove that, H is orthocentre of triangle SBC, then I see at Is there a command to find coordinates of projection of a point on a line in 3D?

\documentclass[border=3mm,12pt,tikz]{standalone}
\usepackage{fouriernc}
\usepackage{tikz,tikz-3dplot} 
\usepackage{tkz-euclide}
\usetkzobj{all} 

\usetikzlibrary{intersections,calc,backgrounds}
\newcommand\pgfmathsinandcos[3]{%
    \pgfmathsetmacro#1{sin(#3)}%
    \pgfmathsetmacro#2{cos(#3)}%
}
\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{3}
    \pgfmathsetmacro\c{4}

    % definitions
    \path
    coordinate(A) at (0,0,0)
    coordinate (B) at (\a,0,0)
    coordinate (C) at (0,\b,0)                           
    coordinate (S) at (0,0,\c)
coordinate (H) at ({\b^2*\c^2*\a/((\b^2+\c^2)*\a^2+\b^2*\c^2)},{\b*\c^2*\a^2/((\b^2+\c^2)*\a^2+\b^2*\c^2)},{\b^2*\c*\a^2/((\b^2+\c^2)*\a^2+\b^2*\c^2)});

\begin{scope}
\draw[dashed,thick]
(A) -- (B)  (A) -- (C)  (S)--(A) --(H) ;
\draw[thick]
(S) -- (B) -- (C) -- cycle;
\end{scope} 
    \foreach \point/\position in {A/left,B/left,C/below,S/above,H/above}
    {
        \fill (\point) circle (1.5pt);
        \node[\position=3pt] at (\point) {$\point$};
    }
    \end{tikzpicture}

    \tdplotsetmaincoords{70}{110}
    %\tdplotsetmaincoords{80}{100}
    \begin{tikzpicture}[tdplot_main_coords,scale=1.5]
    \pgfmathsetmacro\a{4}
    \pgfmathsetmacro\b{3}
\pgfmathsetmacro\c{4}
    % definitions
    \path
coordinate(A) at (0,0,0)
coordinate (B) at (\a,0,0)
coordinate (C) at (0,\b,0)                           
coordinate (S) at (0,0,\c)                
;
\path[projection of point={(0,0,0) on line through (\a,0,0) and (0,0,\c)}]
coordinate (P)
[projection of point={(0,0,0) on line through (0,\b,0) and (0,0,\c)}]
coordinate  (Q)
[projection of point={(0,0,0) on line through (0,\b,0) and (\a,0,0)}]
coordinate (R);



\begin{scope}
\draw [very thick] (S) -- (R);
\draw [very thick, name path=B--Q] (B) -- (Q);
\draw [very thick, name path=C--P] (C) -- (P);
\path [name intersections={of=B--Q and C--P,by=H}];
\end{scope}

\begin{scope}
\draw[dashed,thick]
(A) -- (B)  (A) -- (C)  (S)--(A) (A)--(H) (A)--(R) (A)--(P) (A)--(Q);
\draw[thick]
(S) -- (B) -- (C) -- cycle;
\end{scope}

\tkzMarkRightAngle(S,R,C)
\tkzMarkRightAngle(B,P,C)
\tkzMarkRightAngle(B,Q,C)
\tkzMarkRightAngle(A,R,B)


\foreach \point/\position in {A/left,B/left,C/below,S/above,P/left,Q/above,R/below,H/above}
{
    \fill (\point) circle (1.5pt);
    \node[\position=3pt] at (\point) {$\point$};
}
\end{tikzpicture}
\end{document} 

enter image description here

enter image description here

Is there a command to find coordinates of projection of a point on a plane?

With Maple, If the plane passing through three points A(x1, y1, z1), B(x2, y2, z2), C(x3, y3, z3). The projection H of the point P(x4, y4, z4 on the plane ABC is [((z2^2*x3+((-x2-x3)*z3+z4*(x2-x3))*z2+z3^2*x2-z4*(x2-x3)*z3+x4*(x2-x3)^2)*y1^2+(((-2*z2*x3+(x2+x3)*z3-z4*(x2-x3))*z1+((x1+x3)*z3-z4*(x1-x3))*z2+(-x1-x2)*z3^2+z4*(x1+x2-2*x3)*z3-2*x4*(x2-x3)*(x1-x3))*y2+(((x2+x3)*z2-2*z3*x2+z4*(x2-x3))*z1+(-x1-x3)*z2^2+((x1+x2)*z3+z4*(x1-2*x2+x3))*z2-(x1-x2)*(z3*z4-2*x4*(x2-x3)))*y3+((-x2+x3)*z1+(x1-x3)*z2-z3*(x1-x2))*y4*(z2-z3))*y1+(x3*z1^2+((-x1-x3)*z3+z4*(x1-x3))*z1+x1*z3^2-z4*(x1-x3)*z3+x4*(x1-x3)^2)*y2^2+(((-x2-x3)*z1^2+((x1+x3)*z2+(x1+x2)*z3-2*z4*(x1-(1/2)*x2-(1/2)*x3))*z1+(-2*x1*z3+z4*(x1-x3))*z2-(2*(x1-x2))*(-(1/2)*z3*z4+x4*(x1-x3)))*y3+((-x2+x3)*z1+(x1-x3)*z2-z3*(x1-x2))*(z3-z1)*y4)*y2+(x2*z1^2+((-x1-x2)*z2+z4*(x1-x2))*z1+x1*z2^2-z4*(x1-x2)*z2+x4*(x1-x2)^2)*y3^2-((-x2+x3)*z1+(x1-x3)*z2-z3*(x1-x2))*(z2-z1)*y4*y3+((-x2+x3)*z1+(x1-x3)*z2-z3*(x1-x2))^2*x4)/((z2^2-2*z2*z3+z3^2+(x2-x3)^2)*y1^2+(((-2*z2+2*z3)*z1+2*z2*z3-2*z3^2-(2*(x2-x3))*(x1-x3))*y2+2*y3*((z2-z3)*z1-z2^2+z2*z3+(x2-x3)*(x1-x2)))*y1+(z1^2-2*z3*z1+z3^2+(x1-x3)^2)*y2^2-2*y3*(z1^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+y2^2-y3*y2+(z2-z1)*(z2-z3)))*x1+(y1^2-2*y3*y1+y3^2+(z3-z1)^2)*x2^2-2*x3*(y1^2+(-y2-y3)*y1+y3*y2+(z3-z1)*(z2-z1))*x2+(y1^2-2*y2*y1+y2^2+(z2-z1)^2)*x3^2+((z2-z3)*y1+(z3-z1)*y2-y3*(z2-z1))^2)]

1 Answers1

5

Here is a (first) proposal. A plane is uniquely determined by one point that it contains and its normal. The projection of a point on the plane can then be computed by standard formulae such as this one. This is what's done in

\path[3d projection of point={(0,0,0) on plane through (0,0,\c) with
    normal (\b*\c,\a*\c,\a*\b)}]  coordinate (H);

in the MWE

\documentclass[border=3mm,12pt,tikz]{standalone}
\usepackage{fouriernc}
\usepackage{tikz,tikz-3dplot} 
\usepackage{tkz-euclide}
\usetkzobj{all} 

\usetikzlibrary{intersections,calc,backgrounds}
\newcommand\pgfmathsinandcos[3]{%
    \pgfmathsetmacro#1{sin(#3)}%
    \pgfmathsetmacro#2{cos(#3)}%
}
\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)})}
}}

\tikzset{3d projection of point/.style args={(#1,#2,#3) on plane through (#4,#5,#6)
with normal (#7,#8,#9)}{
/utils/exec={\pgfmathsetmacro{\myprefactor}{(#7*(#1-#4)%
+#8*(#2-#5)+#9*(#3-#6))%
/(#7*#7+#8*#8+#9*#9)}
\pgfmathsetmacro{\myx}{#1-\myprefactor*#7}
\pgfmathsetmacro{\myy}{#2-\myprefactor*#8}
\pgfmathsetmacro{\myz}{#3-\myprefactor*#9}},
insert path={%
({\myx},{\myy},{\myz})}
%/utils/exec={\typeout{(\myx,\myy,\myz)}}
}}

\begin{document}
    \tdplotsetmaincoords{70}{110}
    %\tdplotsetmaincoords{80}{100}
    \begin{tikzpicture}[tdplot_main_coords,scale=1.5]
    \pgfmathsetmacro\a{4}
    \pgfmathsetmacro\b{3}
    \pgfmathsetmacro\c{4}

    % definitions
    \path
    coordinate(A) at (0,0,0)
    coordinate (B) at (\a,0,0)
    coordinate (C) at (0,\b,0)                           
    coordinate (S) at (0,0,\c);
%coordinate (H) at ({\b^2*\c^2*\a/((\b^2+\c^2)*\a^2+\b^2*\c^2)},{\b*\c^2*\a^2/((\b^2+\c^2)*\a^2+\b^2*\c^2)},{\b^2*\c*\a^2/((\b^2+\c^2)*\a^2+\b^2*\c^2)});
    \path[3d projection of point={(0,0,0) on plane through (0,0,\c) with
    normal (\b*\c,\a*\c,\a*\b)}]  coordinate (H);
\begin{scope}
\draw[dashed,thick]
(A) -- (B)  (A) -- (C)  (S)--(A) --(H) ;
\draw[thick]
(S) -- (B) -- (C) -- cycle;
\end{scope} 
    \foreach \point/\position in {A/left,B/left,C/below,S/above,H/above}
    {
        \fill (\point) circle (1.5pt);
        \node[\position=3pt] at (\point) {$\point$};
    }
    \end{tikzpicture}

\end{document} 

enter image description here

In this version, you have to compute the normal by hand. (I did that by computing (B-C) \times (B-S).) This can be done by TikZ. And it is my first real life application of @circumscribes advanced smuggling techniques. No more spamming the whole document with really intelligent macros like \myangle or \mynormal and the like! ;-)

\documentclass[border=3mm,12pt,tikz]{standalone}
\usepackage{fouriernc}
\usepackage{tikz,tikz-3dplot} 
\usepackage{tkz-euclide}
\usetkzobj{all} 

% smuggling from https://tex.stackexchange.com/a/470979/121799
\newcounter{smuggle}
\DeclareRobustCommand\smuggleone[1]{%
  \stepcounter{smuggle}%
  \expandafter\global\expandafter\let\csname smuggle@\arabic{smuggle}\endcsname#1%
  \aftergroup\let\aftergroup#1\expandafter\aftergroup\csname smuggle@\arabic{smuggle}\endcsname
}
\DeclareRobustCommand\smuggle[2][1]{%
  \smuggleone{#2}%
  \ifnum#1>1
    \aftergroup\smuggle\aftergroup[\expandafter\aftergroup\the\numexpr#1-1\aftergroup]\aftergroup#2%
  \fi
}

%\usetikzlibrary{intersections,calc,backgrounds}
\newcommand\pgfmathsinandcos[3]{%
    \pgfmathsetmacro#1{sin(#3)}%
    \pgfmathsetmacro#2{cos(#3)}%
}
\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)})}
},store normal vector of/.code args={(#1,#2,#3) and (#4,#5,#6) in #7}{%
\pgfmathsetmacro{\myx}{#2*#6-#3*#5}%
\pgfmathsetmacro{\myy}{#3*#4-#1*#6}%
\pgfmathsetmacro{\myz}{#1*#5-#2*#4}%
\edef#7{(\myx,\myy,\myz)}%
\smuggle{#7}},3d projection of point/.style args={(#1,#2,#3) on plane through (#4,#5,#6)
with normal (#7,#8,#9)}{
/utils/exec={\pgfmathsetmacro{\myprefactor}{(#7*(#1-#4)%
+#8*(#2-#5)+#9*(#3-#6))%
/(#7*#7+#8*#8+#9*#9)}
\pgfmathsetmacro{\myx}{#1-\myprefactor*#7}
\pgfmathsetmacro{\myy}{#2-\myprefactor*#8}
\pgfmathsetmacro{\myz}{#3-\myprefactor*#9}},
insert path={%
({\myx},{\myy},{\myz})}
}}

\begin{document}
    \tdplotsetmaincoords{70}{110}
    \begin{tikzpicture}[tdplot_main_coords,scale=1.5]
    \pgfmathsetmacro\a{4}
    \pgfmathsetmacro\b{3}
    \pgfmathsetmacro\c{4}

    % definitions
    \path 
    coordinate(A) at (0,0,0)
    coordinate (B) at (\a,0,0)
    coordinate (C) at (0,\b,0)                           
    coordinate (S) at (0,0,\c);
    \path[store normal vector of={(\a,0,-\c) and (0,\b,-\c) in \mynormal},
    3d projection of point/.expanded={(0,0,0) on plane through (0,0,\c) with
    normal \mynormal}]  coordinate (H);

    \begin{scope}
      \draw[dashed,thick]
      (A) -- (B)  (A) -- (C)  (S)--(A) --(H) ;
      \draw[thick]
      (S) -- (B) -- (C) -- cycle;
    \end{scope} 
    \foreach \point/\position in {A/left,B/left,C/below,S/above,H/above}
    {
        \fill (\point) circle (1.5pt);
        \node[\position=3pt] at (\point) {$\point$};
    }
    \end{tikzpicture}

\end{document} 

Clearly, this can be rewritten in many ways, simply since there are many ways you can fix a plane. One alternative to "one point in the plane and its normal vector" could be "three non-degenerate points of the plane".

  • Can your code use to find intersection of point of a line and a plane? – minhthien_2016 Jan 26 '19 at 03:20
  • @minhthien_2016 No, this code does not do that at the moment. (The cleanest way to go would be if you write a new question. It is free of charge, and other may find the information more easily when they search for it.) –  Jan 26 '19 at 03:39
  • OK. I shall post a new question about that. Please help me. – minhthien_2016 Jan 26 '19 at 03:45
  • @minhthien_2016 I added some code that does it. Nevertheless it might be preferable to have separate questions on that. Then other users could find these things a bit more easily. –  Jan 27 '19 at 04:19
  • If the plane take AB as normal vector, example, the plane passing through the point P and perpendicular to the line AB, . – minhthien_2016 Jan 27 '19 at 06:03
  • @minhthien_2016 I am sorry, I do not understand the comment (and will go to bed now). –  Jan 27 '19 at 06:10
  • For example, If I have another picture with \coordinate (C) at (\a,\b,0) and \coordinate (S) at (0,0,\h) and SC is normal vector of a plane, then I write \def\mynormal{(\a,\b,-\h)} \typeout{\mynormal:(\a,\b,-\h)} Is it true? – minhthien_2016 Jan 27 '19 at 14:09
  • I have just asked a new question at here https://tex.stackexchange.com/questions/472175/intersection-of-a-line-with-a-plane-where-is-wrong-in-third-way – minhthien_2016 Jan 28 '19 at 03:52