PSTricks:点和直角的投影(均两次)

PSTricks:点和直角的投影(均两次)

考虑以下代码:

\documentclass{article}

\usepackage{pst-solides3d}

\begin{document}

\begin{figure}[htbp]
\centering
\psset{unit = 0.7}
\begin{pspicture}(-8.1,-5.6)(8.7,17.7)
  \pnodes%
    (0,17.65){A}%
    (0,0){B}%
    (3.09,-3.43){C}%
    (-8.02,1.24){D}%
    (-2.59,-5.57){E}%
    (8.64,-1.34){F}%
    (1.97,4.23){G}
  \pspolygon[linestyle = none, fillstyle = solid, fillcolor = gray!20](D)(E)(F)(G)
  \psSolid[
    object = new,
    action = draw,
    sommets =
       0 -3 0  % punkt 1
      -3  0 0  % punkt 2
       0  3 0  % punkt 3
       3  0 0  % punkt 4
       0  0 6, % punkt 5
    faces = {
      [3 2 1 0] % side A
      [4 0 3]   % side B
      [4 3 2]   % side C
      [4 2 1]   % side D
      [4 1 0]   % side E
    },
    RotZ = 30
  ]
  \psline(0,0.65)(0.45,0.2)(0.45,-0.5)
  \psline(3,-2.85)(3.6,-2.63)(3.67,-3.25)
 {\psset{linestyle = dotted, linecolor = red}
  \psline(A)(B)
  \psline(B)(C)
  \psline(A)(C)}
 {\psset{linestyle = none}
  \pcline[offset = -8.5pt](D)(E)
  \ncput{$g$}
  \pcline[offset = -8pt](E)(F)
  \ncput{$g$}
  \pcline[offset = 7pt](0,12)(B)
  \ncput{$h$}
  \pcline[offset = 8pt](A)(F)
  \ncput{$x$}}
\end{pspicture}
\end{figure}

\end{document}

数字

输出符合我的要求,但两个投影的坐标和直角是通过反复试验找到的。(手动方法的一个问题是,如果我旋转金字塔,绘图就不再正确。)

如何使用pst-solides3d包来绘制整个图形,而无需手动查找坐标?

答案1

\documentclass[pstricks]{standalone}
\usepackage{pst-solides3d}
\begin{document}
\begin{pspicture}(-4,-2)(4,7)
\psset{viewpoint=100 10 20 rtp2xyz,Decran=100,lightsrc=viewpoint,solidmemory}
  \psSolid[
    object = new,
    action = draw*,
    sommets =
       0 -3 0  % punkt 0
      -3  0 0  % punkt 1
       0  3 0  % punkt 2
       3  0 0  % punkt 3
       0  0 6, % punkt 4
    faces = {
      [3 2 1 0] % side A
      [4 0 3]   % side B
      [4 3 2]   % side C
      [4 2 1]   % side D
      [4 1 0]   % side E
      }]
% equation face : 2x+2y+z-6=0
 \psSolid[object=plan,
  definition=normalpoint,name=face2,action=none,
  args={1.5 1.5 0 [-1.5 -1.5 6 2 2 1 -90]},
  showbase]
 \psset{plan=face2} 
 \psProjection[object=rightangle,
  args= 0 1 0 0 1 0] 
  \psPoint(0,0,6){S}
  \psPoint(0,0,0){O}
  \psPoint(1.5,1.5,0){H}
  \psPoint(0,-3,0){A}
  \psPoint(3,0,0){B}
  \psPoint(0,3,0){C}
  \psPoint(-3,0,0){D}
  \psline[linestyle=dotted,linecolor=red](H)(S)
  \psline[linestyle=dotted,linecolor=red](O)(S)
  \psline[linestyle=dotted,linecolor=red](O)(H)
% equation x-y=0
 \psSolid[object=plan,
 definition=normalpoint,name=planmedian,action=none,
  args={0 0 0 [1.5 1.5 0 1 -1 0 0]},showbase]
 \psset{plan=planmedian} 
  \psProjection[object=rightangle,
   args= 0 1 0 0 1 0] 
 \uput[dl](O){$O$}
 \uput[d](H){$H$}
 \uput[u](S){$S$}
 \uput[l](A){$A$}
 \uput[d](B){$B$}
 \uput[r](C){$C$}
 \uput[r](D){$D$}
\end{pspicture}
\end{document} 

在此处输入图片描述

答案2

没有直角平面的矢量(你应该接受另一个答案!):

\begin{pspicture}(-4,-2)(4,7)
\psset{viewpoint=100 10 20 rtp2xyz,Decran=100,solidmemory}
\psSolid[
    object = new,
    action = draw*,
    sommets =
    0 -3 0  % punkt 0
    -3  0 0  % punkt 1
    0  3 0  % punkt 2
    3  0 0  % punkt 3
    0  0 6, % punkt 4
    faces = {
        [3 2 1 0] % side A
        [4 0 3]   % side B
        [4 3 2]   % side C
        [4 2 1]   % side D
        [4 1 0]   % side E
    }]
    % equation face : 2x+2y+z-6=0
\psSolid[object=plan,
    definition=normalpoint,name=face2,action=none,
    args={1.5 1.5 0 [-1.5 -1.5 6 2 2 1 -90]}]
\psProjection[object=rightangle,plan=face2,
    args= 0 1 0 0 1 0] 
    \psPoint(0,0,6){S}
    \psPoint(0,0,0){O}
    \psPoint(1.5,1.5,0){H}
    \psPoint(0,-3,0){A}
    \psPoint(3,0,0){B}
    \psPoint(0,3,0){C}
    \psPoint(-3,0,0){D}
    \psline[linestyle=dotted,linecolor=red](H)(S)
    \psline[linestyle=dotted,linecolor=red](O)(S)
    \psline[linestyle=dotted,linecolor=red](O)(H)
    % equation x-y=0
\psSolid[object=plan,definition=normalpoint,name=planmedian,action=none,
    args={0 0 0 [1.5 1.5 0 1 -1 0 0]}]
\psProjection[object=rightangle,args= 0 1 0 0 1 0,plan=planmedian] 
    \uput[dl](O){$O$}
    \uput[d](H){$H$}
    \uput[u](S){$S$}
    \uput[l](A){$A$}
    \uput[d](B){$B$}
    \uput[r](C){$C$}
    \uput[r](D){$D$}
\end{pspicture}

在此处输入图片描述

相关内容