设S.ABCD
是金字塔,ABCD
是正方形,SA
垂直于平面(ABCD)
;是 在上P
的投影,是在 上的投影。基于A
SC
P
A
SD
答案, 我试过
\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}
有没有其他方法可以使用 TikZ 而不使用 3dtools 来找到直线上的投影点?并绘制经过三个点的圆C, D, P
。
答案1
P
我使用 Maple 来查找两个点和的坐标Q
。关于圆CDP
,我使用 3dtools!因此,我没有添加该代码。
\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}