Intersection of a line with a plane, where is wrong in third way?












1















Let SABCD be a pyramid, SA perpendicular to the plane ABC, the base of pyramid is a rectangle,SA=h, AB=a, AD=b. A plane P passing A and perpendicular to the line SC cut the lines SB, SD, SC respectively at E, F, K.
I tried it in three ways.



First way



documentclass[border=3.14mm,12pt,tikz]{standalone}
usepackage{tikz,tikz-3dplot}
usepackage{tkz-euclide}
usetkzobj{all}
usetikzlibrary{intersections,calc,backgrounds}
begin{document}
tdplotsetmaincoords{60}{120}
begin{tikzpicture}[tdplot_main_coords,scale=1.5]
pgfmathsetmacroa{3}
pgfmathsetmacrob{4}
pgfmathsetmacroh{5}

% 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 ({a*h^2/(a^2+h^2)}, 0, {a^2*h/(a^2+h^2)})
coordinate (F) at (0, {b*h^2/(b^2+h^2)}, {b^2*h/(b^2+h^2)})
coordinate (K) at ({a*h^2/(a^2+b^2+h^2)}, {b*h^2/(a^2+b^2+h^2)}, {(a^2+b^2)*h/(a^2+b^2+h^2)});

begin{scope}
draw [dashed, thick, name path=B--D] (B) -- (D);
draw [dashed, thick, name path=C--A] (C) -- (A);
path [name intersections={of=B--D and C--A,by=O}];
end{scope}

begin{scope}
draw [dashed, thick, name path=S--O] (S) -- (O);
draw [dashed, thick, name path=E--F] (E) -- (F);
path [name intersections={of=S--O and E--F,by=I}];
end{scope}

begin{scope}
draw[dashed, thick]
(A) -- (B) (D)--(A) (S)--(A);
draw[dashed, thick]
(E) --(A) -- (F);
draw[ultra thick]
(S) -- (B) -- (C) -- (D)--cycle (S)--(C) (E) -- (K) --(F);
draw [thick, dashed] (A) -- (K) (E) -- (F) ;
tkzMarkRightAngle(S,A,D)
tkzMarkRightAngle(S,A,B)
tkzMarkRightAngle(A,B,C)
tkzMarkRightAngle(B,A,D)
tkzMarkRightAngle(A,F,D)
tkzMarkRightAngle(A,E,B)
tkzMarkRightAngle(A,K,C)
end{scope}

foreach point/position in {A/left,B/below,C/below,S/above,D/right,E/left,D/right,F/right,K/above right,O/below,I/below}
{
fill (point) circle (1.5pt);
node[position=3pt] at (point) {$point$};
}
end{tikzpicture}

end{document}


Second way



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

newcounter{smuggle}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]aftergroup#2%
fi
}

usetikzlibrary{intersections,calc,backgrounds}
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{60}{120}
begin{tikzpicture}[tdplot_main_coords,scale=1.5]
pgfmathsetmacroa{3}
pgfmathsetmacrob{4}
pgfmathsetmacroh{5}

% 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);

path[projection of point={(0,0,0) on line through (a,0,0) and (0,0,h)}]
coordinate (E)
[projection of point={(0,0,0) on line through (0,0,h) and (0,b,0) }]
coordinate (F)
[projection of point={(0,0,0) on line through (0,0,h) and (a,b,0) }]
coordinate (K);

begin{scope}
draw [dashed, thick, name path=B--D] (B) -- (D);
draw [dashed, thick, name path=C--A] (C) -- (A);
path [name intersections={of=B--D and C--A,by=O}];
end{scope}

begin{scope}
draw [dashed, thick, name path=S--O] (S) -- (O);
draw [dashed, thick, name path=E--F] (E) -- (F);
path [name intersections={of=S--O and E--F,by=I}];
end{scope}


begin{scope}
draw[dashed, thick]
(A) -- (B) (D)--(A) (S)--(A);
draw[dashed, thick]
(E) --(A) -- (F);
draw[ultra thick]
(S) -- (B) -- (C) -- (D)--cycle (S)--(C) (E) -- (K) --(F);
draw [thick, dashed] (A) -- (K) (E) -- (F) ;

tkzMarkRightAngle(S,A,D)
tkzMarkRightAngle(S,A,B)
tkzMarkRightAngle(A,B,C)
tkzMarkRightAngle(B,A,D)
tkzMarkRightAngle(A,F,D)
tkzMarkRightAngle(A,E,B)
tkzMarkRightAngle(A,K,C)
end{scope}

foreach point/position in {A/left,B/below,C/below,S/above,D/right,E/left,D/right,F/right,K/above right,O/below,I/below}
{
fill (point) circle (1.5pt);
node[position=3pt] at (point) {$point$};
}

end{tikzpicture}
end{document}


enter image description here



Third way
Base on the answer Is there a command to find coordinates of projection of a point on a plane?



I defined command defVecMinus(#1,#2,#3)-(#4,#5,#6){(#1-#4,#2-#5,#3-#6)} and tried



documentclass[border=3.14mm,12pt,tikz]{standalone}
usepackage{tikz,tikz-3dplot}
%% smuggling from https://tex.stackexchange.com/a/470979/121799
newcounter{smuggle}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]aftergroup#2%
fi
}

defparsecoord(#1,#2,#3)>(#4,#5,#6){%
def#4{#1}%
def#5{#2}%
def#6{#3}%
smuggle{#4}%
smuggle{#5}%
smuggle{#6}%
}
defSPTD(#1,#2,#3).(#4,#5,#6){#1*#4+#2*#5+#3*#6}
defVPTD(#1,#2,#3)x(#4,#5,#6){(#2*#6-#3*#5,#3*#4-#1*#6,#1*#5-#2*#4)}
defVecMinus(#1,#2,#3)-(#4,#5,#6){(#1-#4,#2-#5,#3-#6)}
defVecAdd(#1,#2,#3)+(#4,#5,#6){(#1+#4,#2+#5,#3+#6)}
tikzset{intersection of line trough/.style args={#1 and #2 with plane
containing #3 and normal #4}{%
/utils/exec={pgfmathsetmacro{ltest}{abs(SPTD#2.#4-SPTD#1.#4)}
parsecoord#1>(myAx,myAy,myAz)
parsecoord#2>(myBx,myBy,myBz)
ifdimltest pt<0.01pt
typeout{Planespace andspace linespace arespace parallel!ltest}
pgfmathsetmacro{myd}{0}
else
pgfmathsetmacro{myd}{(SPTD#3.#4-SPTD#1.#4)/(SPTD#2.#4-SPTD#1.#4)}
fi
%typeout{({myAx+myd*(myBx-myAx)},{myAy+myd*(myBy-myAy)},{myAz+myd*(myBz-myAz)})}
defmyP{({myAx+myd*(myBx-myAx)},{myAy+myd*(myBy-myAy)},{myAz+myd*(myBz-myAz)})}
smugglemyP},
insert path={%
myP}
}}

begin{document}
tdplotsetmaincoords{75}{110}
begin{tikzpicture}[tdplot_main_coords,scale=1.5]
pgfmathsetmacroa{3}
pgfmathsetmacrob{4}
pgfmathsetmacroh{5}

% 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);
defmynormal{VecMinus(a,b,0)-(0,0,h)}
typeout{mynormal:(a,b,-h)}
path[intersection of line trough={(0,0,h) and (a,0,0) with plane containing (0,0,0) and normal (a,b,-h)}] coordinate (E)
[intersection of line trough={(0,0,h) and (0,b,0) with plane containing (0,0,0) and normal (a,b,-h)}] coordinate (F)
[intersection of line trough={(0,0,h) and (a,b,0) with plane containing (0,0,0) and normal (a,b,-h)}] coordinate (K);


draw[dashed, thick]
(A) -- (B) (D)--(A) (S)--(A);
draw[dashed, thick]
(E) --(A) -- (F);
draw[ultra thick]
(S) -- (B) -- (C) -- (D)--cycle (S)--(C);

draw [thick, dashed] (A) -- (K) (A) -- (C) (B) -- (D) (E) -- (F) ;
draw [thick] (E) -- (K) -- (F) ;

foreach point/position in {A/left,B/below,C/below,S/above,D/right,E/left,D/right,F/right,K/above right}
{
fill (point) circle (1.5pt);
node[position=3pt] at (point) {$point$};
}

end{tikzpicture}
end{document}


I got
enter image description here










share|improve this question



























    1















    Let SABCD be a pyramid, SA perpendicular to the plane ABC, the base of pyramid is a rectangle,SA=h, AB=a, AD=b. A plane P passing A and perpendicular to the line SC cut the lines SB, SD, SC respectively at E, F, K.
    I tried it in three ways.



    First way



    documentclass[border=3.14mm,12pt,tikz]{standalone}
    usepackage{tikz,tikz-3dplot}
    usepackage{tkz-euclide}
    usetkzobj{all}
    usetikzlibrary{intersections,calc,backgrounds}
    begin{document}
    tdplotsetmaincoords{60}{120}
    begin{tikzpicture}[tdplot_main_coords,scale=1.5]
    pgfmathsetmacroa{3}
    pgfmathsetmacrob{4}
    pgfmathsetmacroh{5}

    % 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 ({a*h^2/(a^2+h^2)}, 0, {a^2*h/(a^2+h^2)})
    coordinate (F) at (0, {b*h^2/(b^2+h^2)}, {b^2*h/(b^2+h^2)})
    coordinate (K) at ({a*h^2/(a^2+b^2+h^2)}, {b*h^2/(a^2+b^2+h^2)}, {(a^2+b^2)*h/(a^2+b^2+h^2)});

    begin{scope}
    draw [dashed, thick, name path=B--D] (B) -- (D);
    draw [dashed, thick, name path=C--A] (C) -- (A);
    path [name intersections={of=B--D and C--A,by=O}];
    end{scope}

    begin{scope}
    draw [dashed, thick, name path=S--O] (S) -- (O);
    draw [dashed, thick, name path=E--F] (E) -- (F);
    path [name intersections={of=S--O and E--F,by=I}];
    end{scope}

    begin{scope}
    draw[dashed, thick]
    (A) -- (B) (D)--(A) (S)--(A);
    draw[dashed, thick]
    (E) --(A) -- (F);
    draw[ultra thick]
    (S) -- (B) -- (C) -- (D)--cycle (S)--(C) (E) -- (K) --(F);
    draw [thick, dashed] (A) -- (K) (E) -- (F) ;
    tkzMarkRightAngle(S,A,D)
    tkzMarkRightAngle(S,A,B)
    tkzMarkRightAngle(A,B,C)
    tkzMarkRightAngle(B,A,D)
    tkzMarkRightAngle(A,F,D)
    tkzMarkRightAngle(A,E,B)
    tkzMarkRightAngle(A,K,C)
    end{scope}

    foreach point/position in {A/left,B/below,C/below,S/above,D/right,E/left,D/right,F/right,K/above right,O/below,I/below}
    {
    fill (point) circle (1.5pt);
    node[position=3pt] at (point) {$point$};
    }
    end{tikzpicture}

    end{document}


    Second way



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

    newcounter{smuggle}
    DeclareRobustCommandsmuggleone[1]{%
    stepcounter{smuggle}%
    expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
    aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
    }
    DeclareRobustCommandsmuggle[2][1]{%
    smuggleone{#2}%
    ifnum#1>1
    aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]aftergroup#2%
    fi
    }

    usetikzlibrary{intersections,calc,backgrounds}
    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{60}{120}
    begin{tikzpicture}[tdplot_main_coords,scale=1.5]
    pgfmathsetmacroa{3}
    pgfmathsetmacrob{4}
    pgfmathsetmacroh{5}

    % 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);

    path[projection of point={(0,0,0) on line through (a,0,0) and (0,0,h)}]
    coordinate (E)
    [projection of point={(0,0,0) on line through (0,0,h) and (0,b,0) }]
    coordinate (F)
    [projection of point={(0,0,0) on line through (0,0,h) and (a,b,0) }]
    coordinate (K);

    begin{scope}
    draw [dashed, thick, name path=B--D] (B) -- (D);
    draw [dashed, thick, name path=C--A] (C) -- (A);
    path [name intersections={of=B--D and C--A,by=O}];
    end{scope}

    begin{scope}
    draw [dashed, thick, name path=S--O] (S) -- (O);
    draw [dashed, thick, name path=E--F] (E) -- (F);
    path [name intersections={of=S--O and E--F,by=I}];
    end{scope}


    begin{scope}
    draw[dashed, thick]
    (A) -- (B) (D)--(A) (S)--(A);
    draw[dashed, thick]
    (E) --(A) -- (F);
    draw[ultra thick]
    (S) -- (B) -- (C) -- (D)--cycle (S)--(C) (E) -- (K) --(F);
    draw [thick, dashed] (A) -- (K) (E) -- (F) ;

    tkzMarkRightAngle(S,A,D)
    tkzMarkRightAngle(S,A,B)
    tkzMarkRightAngle(A,B,C)
    tkzMarkRightAngle(B,A,D)
    tkzMarkRightAngle(A,F,D)
    tkzMarkRightAngle(A,E,B)
    tkzMarkRightAngle(A,K,C)
    end{scope}

    foreach point/position in {A/left,B/below,C/below,S/above,D/right,E/left,D/right,F/right,K/above right,O/below,I/below}
    {
    fill (point) circle (1.5pt);
    node[position=3pt] at (point) {$point$};
    }

    end{tikzpicture}
    end{document}


    enter image description here



    Third way
    Base on the answer Is there a command to find coordinates of projection of a point on a plane?



    I defined command defVecMinus(#1,#2,#3)-(#4,#5,#6){(#1-#4,#2-#5,#3-#6)} and tried



    documentclass[border=3.14mm,12pt,tikz]{standalone}
    usepackage{tikz,tikz-3dplot}
    %% smuggling from https://tex.stackexchange.com/a/470979/121799
    newcounter{smuggle}
    DeclareRobustCommandsmuggleone[1]{%
    stepcounter{smuggle}%
    expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
    aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
    }
    DeclareRobustCommandsmuggle[2][1]{%
    smuggleone{#2}%
    ifnum#1>1
    aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]aftergroup#2%
    fi
    }

    defparsecoord(#1,#2,#3)>(#4,#5,#6){%
    def#4{#1}%
    def#5{#2}%
    def#6{#3}%
    smuggle{#4}%
    smuggle{#5}%
    smuggle{#6}%
    }
    defSPTD(#1,#2,#3).(#4,#5,#6){#1*#4+#2*#5+#3*#6}
    defVPTD(#1,#2,#3)x(#4,#5,#6){(#2*#6-#3*#5,#3*#4-#1*#6,#1*#5-#2*#4)}
    defVecMinus(#1,#2,#3)-(#4,#5,#6){(#1-#4,#2-#5,#3-#6)}
    defVecAdd(#1,#2,#3)+(#4,#5,#6){(#1+#4,#2+#5,#3+#6)}
    tikzset{intersection of line trough/.style args={#1 and #2 with plane
    containing #3 and normal #4}{%
    /utils/exec={pgfmathsetmacro{ltest}{abs(SPTD#2.#4-SPTD#1.#4)}
    parsecoord#1>(myAx,myAy,myAz)
    parsecoord#2>(myBx,myBy,myBz)
    ifdimltest pt<0.01pt
    typeout{Planespace andspace linespace arespace parallel!ltest}
    pgfmathsetmacro{myd}{0}
    else
    pgfmathsetmacro{myd}{(SPTD#3.#4-SPTD#1.#4)/(SPTD#2.#4-SPTD#1.#4)}
    fi
    %typeout{({myAx+myd*(myBx-myAx)},{myAy+myd*(myBy-myAy)},{myAz+myd*(myBz-myAz)})}
    defmyP{({myAx+myd*(myBx-myAx)},{myAy+myd*(myBy-myAy)},{myAz+myd*(myBz-myAz)})}
    smugglemyP},
    insert path={%
    myP}
    }}

    begin{document}
    tdplotsetmaincoords{75}{110}
    begin{tikzpicture}[tdplot_main_coords,scale=1.5]
    pgfmathsetmacroa{3}
    pgfmathsetmacrob{4}
    pgfmathsetmacroh{5}

    % 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);
    defmynormal{VecMinus(a,b,0)-(0,0,h)}
    typeout{mynormal:(a,b,-h)}
    path[intersection of line trough={(0,0,h) and (a,0,0) with plane containing (0,0,0) and normal (a,b,-h)}] coordinate (E)
    [intersection of line trough={(0,0,h) and (0,b,0) with plane containing (0,0,0) and normal (a,b,-h)}] coordinate (F)
    [intersection of line trough={(0,0,h) and (a,b,0) with plane containing (0,0,0) and normal (a,b,-h)}] coordinate (K);


    draw[dashed, thick]
    (A) -- (B) (D)--(A) (S)--(A);
    draw[dashed, thick]
    (E) --(A) -- (F);
    draw[ultra thick]
    (S) -- (B) -- (C) -- (D)--cycle (S)--(C);

    draw [thick, dashed] (A) -- (K) (A) -- (C) (B) -- (D) (E) -- (F) ;
    draw [thick] (E) -- (K) -- (F) ;

    foreach point/position in {A/left,B/below,C/below,S/above,D/right,E/left,D/right,F/right,K/above right}
    {
    fill (point) circle (1.5pt);
    node[position=3pt] at (point) {$point$};
    }

    end{tikzpicture}
    end{document}


    I got
    enter image description here










    share|improve this question

























      1












      1








      1








      Let SABCD be a pyramid, SA perpendicular to the plane ABC, the base of pyramid is a rectangle,SA=h, AB=a, AD=b. A plane P passing A and perpendicular to the line SC cut the lines SB, SD, SC respectively at E, F, K.
      I tried it in three ways.



      First way



      documentclass[border=3.14mm,12pt,tikz]{standalone}
      usepackage{tikz,tikz-3dplot}
      usepackage{tkz-euclide}
      usetkzobj{all}
      usetikzlibrary{intersections,calc,backgrounds}
      begin{document}
      tdplotsetmaincoords{60}{120}
      begin{tikzpicture}[tdplot_main_coords,scale=1.5]
      pgfmathsetmacroa{3}
      pgfmathsetmacrob{4}
      pgfmathsetmacroh{5}

      % 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 ({a*h^2/(a^2+h^2)}, 0, {a^2*h/(a^2+h^2)})
      coordinate (F) at (0, {b*h^2/(b^2+h^2)}, {b^2*h/(b^2+h^2)})
      coordinate (K) at ({a*h^2/(a^2+b^2+h^2)}, {b*h^2/(a^2+b^2+h^2)}, {(a^2+b^2)*h/(a^2+b^2+h^2)});

      begin{scope}
      draw [dashed, thick, name path=B--D] (B) -- (D);
      draw [dashed, thick, name path=C--A] (C) -- (A);
      path [name intersections={of=B--D and C--A,by=O}];
      end{scope}

      begin{scope}
      draw [dashed, thick, name path=S--O] (S) -- (O);
      draw [dashed, thick, name path=E--F] (E) -- (F);
      path [name intersections={of=S--O and E--F,by=I}];
      end{scope}

      begin{scope}
      draw[dashed, thick]
      (A) -- (B) (D)--(A) (S)--(A);
      draw[dashed, thick]
      (E) --(A) -- (F);
      draw[ultra thick]
      (S) -- (B) -- (C) -- (D)--cycle (S)--(C) (E) -- (K) --(F);
      draw [thick, dashed] (A) -- (K) (E) -- (F) ;
      tkzMarkRightAngle(S,A,D)
      tkzMarkRightAngle(S,A,B)
      tkzMarkRightAngle(A,B,C)
      tkzMarkRightAngle(B,A,D)
      tkzMarkRightAngle(A,F,D)
      tkzMarkRightAngle(A,E,B)
      tkzMarkRightAngle(A,K,C)
      end{scope}

      foreach point/position in {A/left,B/below,C/below,S/above,D/right,E/left,D/right,F/right,K/above right,O/below,I/below}
      {
      fill (point) circle (1.5pt);
      node[position=3pt] at (point) {$point$};
      }
      end{tikzpicture}

      end{document}


      Second way



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

      newcounter{smuggle}
      DeclareRobustCommandsmuggleone[1]{%
      stepcounter{smuggle}%
      expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
      aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
      }
      DeclareRobustCommandsmuggle[2][1]{%
      smuggleone{#2}%
      ifnum#1>1
      aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]aftergroup#2%
      fi
      }

      usetikzlibrary{intersections,calc,backgrounds}
      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{60}{120}
      begin{tikzpicture}[tdplot_main_coords,scale=1.5]
      pgfmathsetmacroa{3}
      pgfmathsetmacrob{4}
      pgfmathsetmacroh{5}

      % 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);

      path[projection of point={(0,0,0) on line through (a,0,0) and (0,0,h)}]
      coordinate (E)
      [projection of point={(0,0,0) on line through (0,0,h) and (0,b,0) }]
      coordinate (F)
      [projection of point={(0,0,0) on line through (0,0,h) and (a,b,0) }]
      coordinate (K);

      begin{scope}
      draw [dashed, thick, name path=B--D] (B) -- (D);
      draw [dashed, thick, name path=C--A] (C) -- (A);
      path [name intersections={of=B--D and C--A,by=O}];
      end{scope}

      begin{scope}
      draw [dashed, thick, name path=S--O] (S) -- (O);
      draw [dashed, thick, name path=E--F] (E) -- (F);
      path [name intersections={of=S--O and E--F,by=I}];
      end{scope}


      begin{scope}
      draw[dashed, thick]
      (A) -- (B) (D)--(A) (S)--(A);
      draw[dashed, thick]
      (E) --(A) -- (F);
      draw[ultra thick]
      (S) -- (B) -- (C) -- (D)--cycle (S)--(C) (E) -- (K) --(F);
      draw [thick, dashed] (A) -- (K) (E) -- (F) ;

      tkzMarkRightAngle(S,A,D)
      tkzMarkRightAngle(S,A,B)
      tkzMarkRightAngle(A,B,C)
      tkzMarkRightAngle(B,A,D)
      tkzMarkRightAngle(A,F,D)
      tkzMarkRightAngle(A,E,B)
      tkzMarkRightAngle(A,K,C)
      end{scope}

      foreach point/position in {A/left,B/below,C/below,S/above,D/right,E/left,D/right,F/right,K/above right,O/below,I/below}
      {
      fill (point) circle (1.5pt);
      node[position=3pt] at (point) {$point$};
      }

      end{tikzpicture}
      end{document}


      enter image description here



      Third way
      Base on the answer Is there a command to find coordinates of projection of a point on a plane?



      I defined command defVecMinus(#1,#2,#3)-(#4,#5,#6){(#1-#4,#2-#5,#3-#6)} and tried



      documentclass[border=3.14mm,12pt,tikz]{standalone}
      usepackage{tikz,tikz-3dplot}
      %% smuggling from https://tex.stackexchange.com/a/470979/121799
      newcounter{smuggle}
      DeclareRobustCommandsmuggleone[1]{%
      stepcounter{smuggle}%
      expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
      aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
      }
      DeclareRobustCommandsmuggle[2][1]{%
      smuggleone{#2}%
      ifnum#1>1
      aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]aftergroup#2%
      fi
      }

      defparsecoord(#1,#2,#3)>(#4,#5,#6){%
      def#4{#1}%
      def#5{#2}%
      def#6{#3}%
      smuggle{#4}%
      smuggle{#5}%
      smuggle{#6}%
      }
      defSPTD(#1,#2,#3).(#4,#5,#6){#1*#4+#2*#5+#3*#6}
      defVPTD(#1,#2,#3)x(#4,#5,#6){(#2*#6-#3*#5,#3*#4-#1*#6,#1*#5-#2*#4)}
      defVecMinus(#1,#2,#3)-(#4,#5,#6){(#1-#4,#2-#5,#3-#6)}
      defVecAdd(#1,#2,#3)+(#4,#5,#6){(#1+#4,#2+#5,#3+#6)}
      tikzset{intersection of line trough/.style args={#1 and #2 with plane
      containing #3 and normal #4}{%
      /utils/exec={pgfmathsetmacro{ltest}{abs(SPTD#2.#4-SPTD#1.#4)}
      parsecoord#1>(myAx,myAy,myAz)
      parsecoord#2>(myBx,myBy,myBz)
      ifdimltest pt<0.01pt
      typeout{Planespace andspace linespace arespace parallel!ltest}
      pgfmathsetmacro{myd}{0}
      else
      pgfmathsetmacro{myd}{(SPTD#3.#4-SPTD#1.#4)/(SPTD#2.#4-SPTD#1.#4)}
      fi
      %typeout{({myAx+myd*(myBx-myAx)},{myAy+myd*(myBy-myAy)},{myAz+myd*(myBz-myAz)})}
      defmyP{({myAx+myd*(myBx-myAx)},{myAy+myd*(myBy-myAy)},{myAz+myd*(myBz-myAz)})}
      smugglemyP},
      insert path={%
      myP}
      }}

      begin{document}
      tdplotsetmaincoords{75}{110}
      begin{tikzpicture}[tdplot_main_coords,scale=1.5]
      pgfmathsetmacroa{3}
      pgfmathsetmacrob{4}
      pgfmathsetmacroh{5}

      % 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);
      defmynormal{VecMinus(a,b,0)-(0,0,h)}
      typeout{mynormal:(a,b,-h)}
      path[intersection of line trough={(0,0,h) and (a,0,0) with plane containing (0,0,0) and normal (a,b,-h)}] coordinate (E)
      [intersection of line trough={(0,0,h) and (0,b,0) with plane containing (0,0,0) and normal (a,b,-h)}] coordinate (F)
      [intersection of line trough={(0,0,h) and (a,b,0) with plane containing (0,0,0) and normal (a,b,-h)}] coordinate (K);


      draw[dashed, thick]
      (A) -- (B) (D)--(A) (S)--(A);
      draw[dashed, thick]
      (E) --(A) -- (F);
      draw[ultra thick]
      (S) -- (B) -- (C) -- (D)--cycle (S)--(C);

      draw [thick, dashed] (A) -- (K) (A) -- (C) (B) -- (D) (E) -- (F) ;
      draw [thick] (E) -- (K) -- (F) ;

      foreach point/position in {A/left,B/below,C/below,S/above,D/right,E/left,D/right,F/right,K/above right}
      {
      fill (point) circle (1.5pt);
      node[position=3pt] at (point) {$point$};
      }

      end{tikzpicture}
      end{document}


      I got
      enter image description here










      share|improve this question














      Let SABCD be a pyramid, SA perpendicular to the plane ABC, the base of pyramid is a rectangle,SA=h, AB=a, AD=b. A plane P passing A and perpendicular to the line SC cut the lines SB, SD, SC respectively at E, F, K.
      I tried it in three ways.



      First way



      documentclass[border=3.14mm,12pt,tikz]{standalone}
      usepackage{tikz,tikz-3dplot}
      usepackage{tkz-euclide}
      usetkzobj{all}
      usetikzlibrary{intersections,calc,backgrounds}
      begin{document}
      tdplotsetmaincoords{60}{120}
      begin{tikzpicture}[tdplot_main_coords,scale=1.5]
      pgfmathsetmacroa{3}
      pgfmathsetmacrob{4}
      pgfmathsetmacroh{5}

      % 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 ({a*h^2/(a^2+h^2)}, 0, {a^2*h/(a^2+h^2)})
      coordinate (F) at (0, {b*h^2/(b^2+h^2)}, {b^2*h/(b^2+h^2)})
      coordinate (K) at ({a*h^2/(a^2+b^2+h^2)}, {b*h^2/(a^2+b^2+h^2)}, {(a^2+b^2)*h/(a^2+b^2+h^2)});

      begin{scope}
      draw [dashed, thick, name path=B--D] (B) -- (D);
      draw [dashed, thick, name path=C--A] (C) -- (A);
      path [name intersections={of=B--D and C--A,by=O}];
      end{scope}

      begin{scope}
      draw [dashed, thick, name path=S--O] (S) -- (O);
      draw [dashed, thick, name path=E--F] (E) -- (F);
      path [name intersections={of=S--O and E--F,by=I}];
      end{scope}

      begin{scope}
      draw[dashed, thick]
      (A) -- (B) (D)--(A) (S)--(A);
      draw[dashed, thick]
      (E) --(A) -- (F);
      draw[ultra thick]
      (S) -- (B) -- (C) -- (D)--cycle (S)--(C) (E) -- (K) --(F);
      draw [thick, dashed] (A) -- (K) (E) -- (F) ;
      tkzMarkRightAngle(S,A,D)
      tkzMarkRightAngle(S,A,B)
      tkzMarkRightAngle(A,B,C)
      tkzMarkRightAngle(B,A,D)
      tkzMarkRightAngle(A,F,D)
      tkzMarkRightAngle(A,E,B)
      tkzMarkRightAngle(A,K,C)
      end{scope}

      foreach point/position in {A/left,B/below,C/below,S/above,D/right,E/left,D/right,F/right,K/above right,O/below,I/below}
      {
      fill (point) circle (1.5pt);
      node[position=3pt] at (point) {$point$};
      }
      end{tikzpicture}

      end{document}


      Second way



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

      newcounter{smuggle}
      DeclareRobustCommandsmuggleone[1]{%
      stepcounter{smuggle}%
      expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
      aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
      }
      DeclareRobustCommandsmuggle[2][1]{%
      smuggleone{#2}%
      ifnum#1>1
      aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]aftergroup#2%
      fi
      }

      usetikzlibrary{intersections,calc,backgrounds}
      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{60}{120}
      begin{tikzpicture}[tdplot_main_coords,scale=1.5]
      pgfmathsetmacroa{3}
      pgfmathsetmacrob{4}
      pgfmathsetmacroh{5}

      % 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);

      path[projection of point={(0,0,0) on line through (a,0,0) and (0,0,h)}]
      coordinate (E)
      [projection of point={(0,0,0) on line through (0,0,h) and (0,b,0) }]
      coordinate (F)
      [projection of point={(0,0,0) on line through (0,0,h) and (a,b,0) }]
      coordinate (K);

      begin{scope}
      draw [dashed, thick, name path=B--D] (B) -- (D);
      draw [dashed, thick, name path=C--A] (C) -- (A);
      path [name intersections={of=B--D and C--A,by=O}];
      end{scope}

      begin{scope}
      draw [dashed, thick, name path=S--O] (S) -- (O);
      draw [dashed, thick, name path=E--F] (E) -- (F);
      path [name intersections={of=S--O and E--F,by=I}];
      end{scope}


      begin{scope}
      draw[dashed, thick]
      (A) -- (B) (D)--(A) (S)--(A);
      draw[dashed, thick]
      (E) --(A) -- (F);
      draw[ultra thick]
      (S) -- (B) -- (C) -- (D)--cycle (S)--(C) (E) -- (K) --(F);
      draw [thick, dashed] (A) -- (K) (E) -- (F) ;

      tkzMarkRightAngle(S,A,D)
      tkzMarkRightAngle(S,A,B)
      tkzMarkRightAngle(A,B,C)
      tkzMarkRightAngle(B,A,D)
      tkzMarkRightAngle(A,F,D)
      tkzMarkRightAngle(A,E,B)
      tkzMarkRightAngle(A,K,C)
      end{scope}

      foreach point/position in {A/left,B/below,C/below,S/above,D/right,E/left,D/right,F/right,K/above right,O/below,I/below}
      {
      fill (point) circle (1.5pt);
      node[position=3pt] at (point) {$point$};
      }

      end{tikzpicture}
      end{document}


      enter image description here



      Third way
      Base on the answer Is there a command to find coordinates of projection of a point on a plane?



      I defined command defVecMinus(#1,#2,#3)-(#4,#5,#6){(#1-#4,#2-#5,#3-#6)} and tried



      documentclass[border=3.14mm,12pt,tikz]{standalone}
      usepackage{tikz,tikz-3dplot}
      %% smuggling from https://tex.stackexchange.com/a/470979/121799
      newcounter{smuggle}
      DeclareRobustCommandsmuggleone[1]{%
      stepcounter{smuggle}%
      expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
      aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
      }
      DeclareRobustCommandsmuggle[2][1]{%
      smuggleone{#2}%
      ifnum#1>1
      aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]aftergroup#2%
      fi
      }

      defparsecoord(#1,#2,#3)>(#4,#5,#6){%
      def#4{#1}%
      def#5{#2}%
      def#6{#3}%
      smuggle{#4}%
      smuggle{#5}%
      smuggle{#6}%
      }
      defSPTD(#1,#2,#3).(#4,#5,#6){#1*#4+#2*#5+#3*#6}
      defVPTD(#1,#2,#3)x(#4,#5,#6){(#2*#6-#3*#5,#3*#4-#1*#6,#1*#5-#2*#4)}
      defVecMinus(#1,#2,#3)-(#4,#5,#6){(#1-#4,#2-#5,#3-#6)}
      defVecAdd(#1,#2,#3)+(#4,#5,#6){(#1+#4,#2+#5,#3+#6)}
      tikzset{intersection of line trough/.style args={#1 and #2 with plane
      containing #3 and normal #4}{%
      /utils/exec={pgfmathsetmacro{ltest}{abs(SPTD#2.#4-SPTD#1.#4)}
      parsecoord#1>(myAx,myAy,myAz)
      parsecoord#2>(myBx,myBy,myBz)
      ifdimltest pt<0.01pt
      typeout{Planespace andspace linespace arespace parallel!ltest}
      pgfmathsetmacro{myd}{0}
      else
      pgfmathsetmacro{myd}{(SPTD#3.#4-SPTD#1.#4)/(SPTD#2.#4-SPTD#1.#4)}
      fi
      %typeout{({myAx+myd*(myBx-myAx)},{myAy+myd*(myBy-myAy)},{myAz+myd*(myBz-myAz)})}
      defmyP{({myAx+myd*(myBx-myAx)},{myAy+myd*(myBy-myAy)},{myAz+myd*(myBz-myAz)})}
      smugglemyP},
      insert path={%
      myP}
      }}

      begin{document}
      tdplotsetmaincoords{75}{110}
      begin{tikzpicture}[tdplot_main_coords,scale=1.5]
      pgfmathsetmacroa{3}
      pgfmathsetmacrob{4}
      pgfmathsetmacroh{5}

      % 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);
      defmynormal{VecMinus(a,b,0)-(0,0,h)}
      typeout{mynormal:(a,b,-h)}
      path[intersection of line trough={(0,0,h) and (a,0,0) with plane containing (0,0,0) and normal (a,b,-h)}] coordinate (E)
      [intersection of line trough={(0,0,h) and (0,b,0) with plane containing (0,0,0) and normal (a,b,-h)}] coordinate (F)
      [intersection of line trough={(0,0,h) and (a,b,0) with plane containing (0,0,0) and normal (a,b,-h)}] coordinate (K);


      draw[dashed, thick]
      (A) -- (B) (D)--(A) (S)--(A);
      draw[dashed, thick]
      (E) --(A) -- (F);
      draw[ultra thick]
      (S) -- (B) -- (C) -- (D)--cycle (S)--(C);

      draw [thick, dashed] (A) -- (K) (A) -- (C) (B) -- (D) (E) -- (F) ;
      draw [thick] (E) -- (K) -- (F) ;

      foreach point/position in {A/left,B/below,C/below,S/above,D/right,E/left,D/right,F/right,K/above right}
      {
      fill (point) circle (1.5pt);
      node[position=3pt] at (point) {$point$};
      }

      end{tikzpicture}
      end{document}


      I got
      enter image description here







      tikz-pgf tikz-3dplot






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 11 mins ago









      minhthien_2016minhthien_2016

      1,180816




      1,180816






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "85"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f472175%2fintersection-of-a-line-with-a-plane-where-is-wrong-in-third-way%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f472175%2fintersection-of-a-line-with-a-plane-where-is-wrong-in-third-way%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Contact image not getting when fetch all contact list from iPhone by CNContact

          count number of partitions of a set with n elements into k subsets

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks