9

I created the following diagram with pst-pers that I learnt from pstricks.blogspot.com.

enter image description here

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

Instead of using the "fake" 2D packages, I am interested in using the real 3D packages such as pst-3d, pst-3dplot, pst-solides3d. Unfortunately, I have not used them yet so I am looking for an example from which I can learn. Learning by real examples is more useful for me than reading the manual from start to finish.

11
+500

Approach using only pst-solides3d

UPDATE - A few improvements

Instead of calculating the points E and F (altitudes of triangles ABSand ACS, respectively) with:

\psProjection[object=point,definition=interdroite]

whose length is dependent on the dimension of the grid defined with base, these are obtained directly with:

\psProjection[object=point,definition=orthoproj]

and then are linked to point A with:

\psProjection[object=line]

Concerning the line quality (smoothness), a better solution compared to the splitting one is to add the option resolution.

I have rewritten the code by adding some geometric and trigonometric dependencies to make it a little more generic.

Output:

enter image description here

Code:

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

OLD

Output:

enter image description here

Code:

\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}
  • How to find the coordinate of B,E,F? Why E is (0,4.9,4), F is (-3,4,5) ? – user173875 Jul 3 at 8:26
  • How to draw the smooth line? – user173875 Jul 3 at 8:28
  • @TrongVuong, in my MWE the geometry of the irregular tetrahedron is known, i.e., the sommets (points) A,B,C and S are inputs. The goal is to draw the altitudes of the triangles ABS and ACS and their circumcenters. For simplicity, I have chosen a Pythagorean triple (6,8,10) for the right-angled triangle ABC. Points E and F defined with \psPoint are just for a better appearance (same plane as A,B, C, and S). These two points are really calculated, please put the commented text=E and text=F inside of \psProjection[object=point,definition=interdroite} and comment \uput for E and F – Ñako Jul 3 at 12:04
  • @TrongVuong, since the option plotpoints does not work, a workaround is to split the circle cercle in arcs with the range option. – Ñako Jul 3 at 12:09
  • 1
    TikZ is not good for 3D. Asymptote is very good for 3D. And PSTricks is much better than TikZ for 3D. I think so! – Money Oriented Programmer Jul 3 at 18:15

Your Answer

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