5

Consider the following code:

\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}

figure

The output is as I would like but the coordinates of the two projections and the right angles are found by trial and error. (One problem with the manually approach being that if I rotate the pyramid, the drawing is no longer correct.)

How do I use the pst-solides3d package to draw he entire drawing without having to find the coordinates manually?

2
  • 1
    Side note: what happened to the Hpyramide question? I thought it was interesting, but then it disappeared... – Marijn Jun 14 '18 at 14:33
  • @Marijn The package is very old and I found pst-solides3d which seems more up to date and easier to use. – Svend Tveskæg Jun 14 '18 at 16:37
2
\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} 

enter image description here

1
  • Really nice. How do I remove the arrows from the right angles so that I "only" have the small square? – Svend Tveskæg Jun 17 '18 at 10:37
3

Without the vectors for the rightangle plane (you should accept the other amswer!):

\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}

enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.