仅使用pst-solides3d

仅使用pst-solides3d

pst-pers我根据从中学到的知识 创建了下面的图表pstricks.blogspot.com

在此处输入图片描述

\documentclass[12pt,preview,border=15pt]{standalone}
\usepackage{pstricks-add,pst-pers,vecteurs}

\begin{document}
\begin{pspicture}[linejoin=1](-1,-2)(7,7)
\psset{fuyante=95}
\xintdefvar aa:= 6.5;

\VecDef{A}{0,0,0}
\VecDef{F}{5,aa+8,0}
\VecDef{C}{0-1,6,0}
\VecDef{S}{0,0,aa}
%%
\persNodeX(A){A}
\persNodeX(F){F}
\persNodeX(C){C}
\persNodeX(S){S}
%%
\ProjectPtOnLine(A)(F)(C){B}{CB}
\persNodeX(B){B}
\ProjectPtOnLine(S)(B)(A){E}{AE}
\persNodeX(E){E}
\ProjectPtOnLine(S)(C)(A){F}{AF}
\persNodeX(F){F}
%%
\foreach \Angle/\Name in {135/A,-45/C,-45/B,90/S,5/E,5/F}{\uput[\Angle](\Name){$\Name$}}
%%
\perspectiveX(B)(C){A}{\pstRightAngle{A}{B}{C}}
\perspectiveX(A)(B){S}{\pstRightAngle{A}{E}{B}}
\perspectiveX(C)(A){S}{\pstRightAngle{A}{F}{C}}
\perspectiveX(B)(C){S}{\pstTriangleOC[linewidth=1pt]{E}{B}{C}}
  \perspectiveX(E)(F){A}{%  
     \pstTriangleOC[linestyle=none]{A}{E}{F}
     \pstCurvAbsNode[PointSymbol=none,PointName=none]{OC_O}{E}{Z}{\pstDistVal{3.12}}
     \pstCurvAbsNode[PointSymbol=none,PointName=none]{OC_O}{E}{Z1}{\pstDistVal{7.3}}
       \psarcAB(OC_O)(Z1)(Z)
       \psarcAB[linestyle=dashed](OC_O)(Z)(Z1)
}
\psline(S)(A)(B)(C)(S)(B)
\psline(A)(E)(F)
\psLineSegments[linestyle=dashed](A)(C)(A)(F)
\end{pspicture}
\end{document}

我不想使用“假”的 2D 包,而是想使用真正的 3D 包,例如pst-3d、、pst-3dplotpst-solides3d不幸的是,我还没有使用过它们,所以我正在寻找一个可以学习的例子。通过真实的例子学习对我来说比从头到尾阅读手册更有用。

答案1

仅使用pst-solides3d

更新 - 一些改进

不用计算点EF(分别为三角形ABS和的高度ACS),而是使用:

\psProjection[object=point,definition=interdroite]

其长度取决于用 定义的网格的维度base,这些可以通过以下方式直接获得:

\psProjection[object=point,definition=orthoproj]

然后链接到点A

\psProjection[object=line]

考虑到线条质量(平滑度),比分割更好的解决方案是添加选项resolution

我通过添加一些几何和三角依赖关系重写了代码,使其更加通用。

输出:

在此处输入图片描述

代码:

\documentclass{minimal}
\usepackage{pstricks}
\usepackage{auto-pst-pdf}
\usepackage{pst-solides3d}
\begin{document}
    \begin{pspicture}(-4,-2)(4,7)
    \pstVerb{/Ax 0 def  /Ay 0 def   /Az 0 def   % Definition point A
            /Bx 0 def   /By 8 def   /Bz 0 def   % Definition point B
            /Cx -6 def  /Cy 8 def   /Cz 0 def   % Definition point C
            /Sx 0 def   /Sy 0 def   /Sz 10 def  % Definition point S
            %-------------SOME GEOMETRIC AND TRIGONOMETRIC DEPENDENCIES (with respect to the global coordinate systems)--------------------------------
            %--------------Triangle ABS
            /dAB Bx Ax sub 2 exp By Ay sub 2 exp add Bz Az sub 2 exp add sqrt def   % Side c triangle ABS, Side b triangle ABC, Hypotenuse a right-angled triangle AEB
            /dAS Sx Ax sub 2 exp Sy Ay sub 2 exp add Sz Az sub 2 exp add sqrt def   % Side b triangle ABS, Side c triangle ACS, Hypotenuse a right-angled triangle AES
            /dBS Sx Bx sub 2 exp Sy By sub 2 exp add Sz Bz sub 2 exp add sqrt def   % Side a triangle ABS, Cathetus c triangle BCS
            /sABS dAB dAS add dBS add 2 div def % Semiperimeter triangle ABS
            /ArABS sABS dAB sub sABS dAS sub mul sABS dBS sub mul sABS mul sqrt def % Area triangle ABS
            /haABS 2 ArABS mul dBS div def % Altitude ha triangle ABS, Cathetus b right-angled triangle AEB, Cathetus c right-angled triangle AES
            /dAE haABS def  % Distance dAE, Cathetus c right-angled triangle AES
            /dEB dAB 2 exp dAE 2 exp sub sqrt def   % n: Orthographic projection of c triangle ABS, Cathetus c right-angled triangle AEB
            /dES dAS 2 exp dAE 2 exp sub sqrt def   % m: Orthographic projection of b triangle ABS, Cathetus b right-angled triangle AES
            /hAEB dAE dEB mul dAB div def   % Altitude right-angled triangle AEB
            /hAES dAE dES mul dAS div def   % Altitude right-angled triangle AES
            %--------------Triangle ACS
            /dAC Cx Ax sub 2 exp Cy Ay sub 2 exp add Cz Az sub 2 exp add sqrt def   % Side c triangle ACS, Side c triangle ABC, Hypotenuse a right-angled triangle AFC
            /dCS Sx Cx sub 2 exp Sy Cy sub 2 exp add Sz Cz sub 2 exp add sqrt def   % Side a triangle ACS, Side b triangle BCS
            /sACS dAC dAS add dCS add 2 div def % Semiperimeter triangle ACS
            /ArACS sACS dAC sub sACS dAS sub mul sACS dCS sub mul sACS mul sqrt def % Area triangle ACS
            /haACS 2 ArACS mul dCS div def % Altitude ha triangle ACS, Cathetus b right-angled triangle AFC, Cathetus c right-angled triangle AFS
            /dAF haACS def  % Distance dAF, Cathetus c right-angled triangle AFS
            /dFC dAC 2 exp dAF 2 exp sub sqrt def   % n: Orthographic projection of c triangle ACS, Cathetus c right-angled triangle AFC
            /dFS dAS 2 exp dAF 2 exp sub sqrt def   % m: Orthographic projection of b triangle ACS, Cathetus b right-angled triangle AFS
            /hAFC dAF dFC mul dAC div def   % Altitude right-angled triangle AFC
            /hAFS dAF dFS mul dAS div def   % Altitude right-angled triangle AFS
            %--------------Triangle ABC
            /dBC Cx Bx sub 2 exp Cy By sub 2 exp add Cz Bz sub 2 exp add sqrt def   % Side c triangle ABC, Side c triangle BCS
        }
    \psset{viewpoint=100 10 20 rtp2xyz,Decran=100,solidmemory}
    \psSolid[
    object=new,
    action=draw,
    sommets =
    Ax  Ay  Az  % point 0 - A
    Bx  By  Bz  % point 1 - B
    Cx  Cy  Cz  % point 2 - C
    Sx  Sy  Sz, % point 3 - S
    faces = {
        [3 0 1] % side B
        [3 2 0] % side C
        [3 1 2] % side D
    }]
    \psPoint(Ax,Ay,Az){A}
    \psPoint(Bx,By,Bz){B}
    \psPoint(Cx,Cy,Cz){C}
    \psPoint(Sx,Sy,Sz){S}
    %---------------------------------------
    %ABC equation 48z = 0
    \psSolid[object=plan,definition=equation,action=none,args={[0 0 48 0]}, origine= 0 0 0,base= -6 0 0 8,name=planABC]
    %ABS equation 80x = 0
    \psSolid[object=plan,definition=equation,action=none,args={[80 0 0 0] 90}, origine= 0 0 0,base= 0 8 0 10,name=planABS]
    %ACS equation 80x + 60y = 0
    \psSolid[object=plan,definition=equation,action=none,args={[80 60 0 0] 180}, origine= 0 0 0,base= 0 10 0 10,name=planACS]
    %BCS equation 60y + 48z - 480 = 0
    \psSolid[object=plan,definition=equation,action=none,args={[0 60 48 -480]}, origine= 0 0 0,base= -6 0 0 dBS,name=planBCS] 
    %AEF equation 548875x - 731625y + 914625z = 0
    \psSolid[object=plan,definition=equation,action=none,args={[548875 -731625 914625 0] 0}, origine= 0 0 0,base= -5 0 0 haABS,name=planAEF]
    %---------------------------------------
    \psset{plan=planABC}
    \psProjection[object=point,action=none,name=aABC](Ax,Ay)
    \psProjection[object=point,action=none,name=bABC](Bx,By)
    \psProjection[object=point,action=none,name=cABC](Cx,Cy)
    \psProjection[object=rightangle,args= aABC bABC cABC]
    %---------------------------------------
    \psset{plan=planABS}
    \psProjection[object=point,action=none,name=aABS](Ay,Az)
    \psProjection[object=point,action=none,name=bABS](By,Bz)
    \psProjection[object=point,action=none,name=sABS](Sy,Sz)
    \psProjection[object=point,definition=orthoproj,action=none,name=eABS,pos=ur,args=aABS bABS sABS] %text=E
    \psProjection[object=line,linecolor=black,name=lABS,args=aABS eABS]
    \psProjection[object=rightangle,args= aABS eABS bABS]
    %----------------------------------------
    \psset{plan=planACS}
    \psProjection[object=point,action=none,name=aACS](0,0)
    \psProjection[object=point,action=none,name=cACS](dAC,0)
    \psProjection[object=point,action=none,name=sACS](0,dAS)
    \psProjection[object=point,definition=orthoproj,action=none,name=fACS,pos=ur,args=aACS cACS sACS] %text=F
    \psProjection[object=line,linecolor=black,linestyle=dashed,name=lACS,args=aACS fACS]
    \psProjection[object=rightangle,args= aACS fACS cACS]
    %-----------------------------------------
    \psset{plan=planBCS}
    \psProjection[object=point,action=none,name=sBCS](0,0)
    \psProjection[object=point,action=none,name=bBCS](0,dBS)
    \psProjection[object=point,action=none,name=cBCS](dBC neg,dBS)
    \psProjection[object=point,action=none,name=eBCS](0,dES)
    \psProjection[object=point,action=none,name=fBCS](dBC dFS mul dCS div neg,dFS dBS mul dCS div)
    \psProjection[object=line,linecolor=black,name=lBCS,args=eBCS fBCS]
    \psProjection[object=cercle,definition=ABcercle,args=eBCS bBCS cBCS,linecolor=black,range=0 360,resolution=720]
    %---------------------------------------
    \psset{plan=planAEF}
    \psProjection[object=point,action=none,name=aAEF](0,0)
    \psProjection[object=point,action=none,name=eAEF](0,dAE)
    \psProjection[object=point,action=none,name=fAEF](dAF 2 exp dAE 2 exp sub sqrt neg,dAE)
    \psProjection[object=cercle,definition=ABcercle,args=aAEF eAEF fAEF,linecolor=black,range=-133 120,resolution=720]
    \psProjection[object=cercle,definition=ABcercle,args=eAEF aAEF fAEF,linecolor=black,linestyle=dashed,range=120 225,resolution=720]
    %---------------------------------------
    \psPoint(0,hAES,hAEB){E} %Just for better appearance
    \psPoint(hAFS dBC mul dAC div neg,hAFS dAB mul dAC div,hAFS){F} %Just for better appearance
    \uput[l](A){$A$}
    \uput[d](B){$B$}
    \uput[r](C){$C$}
    \uput[u](S){$S$}
    \uput[r](F){$F$}
    \uput[r](E){$E$}
    %
    \end{pspicture}
\end{document}

老的

输出:

在此处输入图片描述

代码:

\documentclass{minimal}
\usepackage{pstricks}
\usepackage{auto-pst-pdf}
\usepackage{pst-solides3d}
\begin{document}
    \begin{pspicture}(-4,-2)(4,7)
    \psset{viewpoint=100 10 20 rtp2xyz,Decran=100,solidmemory}
    \psSolid[
    object=new,
    action=draw,
    sommets =
    0   0  0  % point 0 - A
    0   8  0  % point 1 - B
    -6  8  0  % point 2 - C
    0   0  10, % point 3 - S
    faces = {
        [3 0 1] % side B
        [3 2 0] % side C
        [3 1 2] % side D
    }]
    \psPoint(0,0,0){A}
    \psPoint(0,8,0){B}
    \psPoint(-6,8,0){C}
    \psPoint(0,0,10){S}
    \psPoint(0,4.9,3.9){E} %Just for better appearance
    \psPoint(-3,4,5){F} %Just for better appearance
    %---------------------------------------
    %ABC equation 48z = 0
    \psSolid[object=plan,definition=equation,action=none,args={[0 0 48 0]}, origine= 0 0 0,name=planABC]
    %ABS equation 80x = 0
    \psSolid[object=plan,definition=equation,action=none,args={[80 0 0 0] 90}, origine= 0 0 0,base= 0 4.87 0 4,name=planABS]
    %ACS equation 80x + 60y = 0
    \psSolid[object=plan,definition=equation,action=none,args={[80 60 0 0] 180}, origine= 0 0 0,base= 0 5 0 5,name=planACS]
    %BCS equation 60y + 48z - 480 = 0
    \psSolid[object=plan,definition=equation,action=none,args={[0 60 48 -480]}, origine= 0 0 0,base= -5 5 0 15,name=planBCS]
    %AEF equation 548875x - 731625y + 914625z = 0
    \psSolid[object=plan,definition=equation,action=none,args={[548875 -731625 914625 0] 0}, origine= 0 0 0,base= -5 7 0 7,name=planAEF]
    %---------------------------------------
    %---------------------------------------
    \psset{plan=planABC}
    \psProjection[object=point,action=none,name=aABC](0,0)
    \psProjection[object=point,action=none,name=bABC](0,8)
    \psProjection[object=point,action=none,name=cABC](-6,8)
    \psProjection[object=rightangle, args= aABC bABC cABC]
    %---------------------------------------
    \psset{plan=planABS}
    \psProjection[object=point,action=none,name=aABS](0,0)
    \psProjection[object=point,action=none,name=bABS](8,0)
    \psProjection[object=point,action=none,name=sABS](0,10)
    \psProjection[object=droite,linecolor=black,definition=perp,name=lpABS,args=sABS bABS aABS]
    \psProjection[object=droite,linecolor=black,name=lsbABS,args=sABS bABS]
    \psProjection[object=point,definition=interdroite,action=none,name=eABS,pos=ur,args=lpABS lsbABS] %text=E
    \psProjection[object=rightangle, args= aABS eABS bABS]
    %----------------------------------------
    \psset{plan=planACS}
    \psProjection[object=point,action=none,name=aACS](0,0)
    \psProjection[object=point,action=none,name=cACS](10,0)
    \psProjection[object=point,action=none,name=sACS](0,10)
    \psProjection[object=droite,linecolor=black,linestyle=dashed,definition=perp,name=lpACS,args=sACS cACS aACS]
    \psProjection[object=droite,linecolor=red,name=lsbACS,args=sACS cACS]
    \psProjection[object=point,definition=interdroite,action=none,name=fACS,pos=ur,args=lpACS lsbACS] %text=F
    \psProjection[object=rightangle, args= aACS fACS cACS]
    %-----------------------------------------
    \psset{plan=planBCS}
    \psProjection[object=point,action=none,name=sBCS](0,0)
    \psProjection[object=point,action=none,name=bBCS](0,12.8)
    \psProjection[object=point,action=none,name=cBCS](-6,12.8)
    \psProjection[object=point,action=none,name=eBCS](0,7.8)
    \psProjection[object=point,action=none,name=fBCS](-3,6.4)
    %\psProjection[object=cercle,definition=ABcercle,args=eBCS bBCS cBCS,linecolor=black,range=0 360,] %splitted to improve the line smoothness (quality)
    \psProjection[object=cercle,definition=ABcercle,args=eBCS bBCS cBCS,linecolor=black,range=0 90,]
    \psProjection[object=cercle,definition=ABcercle,args=eBCS bBCS cBCS,linecolor=black,range=90 180,]
    \psProjection[object=cercle,definition=ABcercle,args=eBCS bBCS cBCS,linecolor=black,range=180 270,]
    \psProjection[object=cercle,definition=ABcercle,args=eBCS bBCS cBCS,linecolor=black,range=270 360,]
    %---------------------------------------
    \psset{plan=planAEF}
    \psProjection[object=point,action=none,name=aAEF](0,0)
    \psProjection[object=point,action=none,name=eAEF](0,6.25)
    \psProjection[object=point,action=none,name=fAEF](-3.35,6.25)
    %\psProjection[object=cercle,definition=ABcercle,args=aAEF eAEF fAEF,linecolor=black,range=-133 120] %splitted to improve the line smoothness (quality)
    \psProjection[object=cercle,definition=ABcercle,args=aAEF eAEF fAEF,linecolor=black,range=-133 -6.5]
    \psProjection[object=cercle,definition=ABcercle,args=aAEF eAEF fAEF,linecolor=black,range=-6.5 120]
    %\psProjection[object=cercle,definition=ABcercle,args=eAEF aAEF fAEF,linecolor=black,linestyle=dashed,range=120 225] %splitted to improve the line smoothness (quality)
    \psProjection[object=cercle,definition=ABcercle,args=eAEF aAEF fAEF,linecolor=black,linestyle=dashed,range=120 172.5]
    \psProjection[object=cercle,definition=ABcercle,args=eAEF aAEF fAEF,linecolor=black,linestyle=dashed,range=172.5 225]
    %
    \uput[l](A){$A$}
    \uput[d](B){$B$}
    \uput[r](C){$C$}
    \uput[u](S){$S$}
    \uput[r](F){$F$}
    \uput[r](E){$E$}
    %
    \end{pspicture}
\end{document}

相关内容