1

I am trying to create a 3D graph using pst-3dplot as shown below: enter image description here

The problem is that the orange plane is not transparent as it blocks some portion of the cylinder.

May I know how to fix the tranparency issue? I have already read some discussion here about the same topic to no avail. I know I can use pst-solides3d but I would like to stick to pst-3dplot for uniformity.

In case it helps, I am using TeX Live Utility Version 1.54. Thank you in advance.

2
  • I see. Is it possible to compile it with xelatex? Commented Nov 17, 2023 at 18:17
  • Was my fault. Not a bug only the missing first line
    – user187802
    Commented Nov 17, 2023 at 18:46

1 Answer 1

3

You missed the line \DocumentMetadata{} as first line. It allows for lualatex the transparency:

\DocumentMetadata{}
\documentclass[pstricks]{standalone}
\usepackage{pst-3dplot}
\begin{document}
    
\begin{pspicture*}(-3,-1)(3,3.5)
\parametricplotThreeD[xPlotpoints=20, yPlotpoints=20,  linecolor=cyan!30, linewidth=1pt, 
        plotstyle=curve, algebraic=true, fillstyle=solid, fillcolor=cyan!30, opacity=0.5]
        (0,3)(0, 6.2831853){cos(u) | sin(u) | t}   %% the cylinder x^2 + y^2 = 1
            
\parametricplotThreeD[xPlotpoints=20, yPlotpoints=20,  linecolor=blue, ,linestyle=solid, 
      dash=3pt 2pt, linewidth=1pt, plotstyle=curve, algebraic, fillcolor=cyan!30]
   (0,6.2831853){cos(t) | sin(t) | 3 } 
            
\parametricplotThreeD[xPlotpoints=20, yPlotpoints=20,  linecolor=blue, linestyle=solid, 
      dash=3pt 2pt, linewidth=1pt, plotstyle=curve, algebraic, fillcolor=cyan!30]
  (0,6.2831853){cos(t) | sin(t) | 0 } 
            
%\psplotThreeD[plotstyle=line,algebraic=true, yPlotpoints=200,xPlotpoints=200,
%    linewidth=1pt, linecolor=orange!30, hiddenLine=true, drawStyle=xyLines, fillstyle=solid,  
%    fillcolor=orange!30, opacity=0.5](-2, 2)(-2, 2){  1.5  }  %% the plane z = 1.5
            
\parametricplotThreeD[xPlotpoints=20, yPlotpoints=20,  linecolor=blue, linestyle=dashed, 
     dash=3pt 2pt, linewidth=1pt, plotstyle=curve, algebraic, fillcolor=cyan!30]
  (0,6.2831853){cos(t) | sin(t) | 1.5 } 
            
\pstThreeDCoor[linecolor=black,linewidth=1pt,IIIDxTicksPlane=xz, 
IIIDyTicksPlane=yz,spotX=180,xMin=-2,xMax=2,yMin=-2,yMax=2,zMin=-1,zMax=3.5,nameX=$x$, nameY=$y$, 
nameZ=$z$, labels=none] 

\pstThreeDSquare[linewidth=1pt,linecolor=orange!30,fillstyle=solid,fillcolor=orange!30,opacity=0.5]
    (-2,-2,1.5)(4,0,0)(0,4,0)
\end{pspicture*}
    
\end{document}

enter image description here

There is also a \pstThreeDCircle ...

\DocumentMetadata{}
\documentclass[pstricks]{standalone}
\usepackage{pst-3dplot}
\begin{document}
    
\begin{pspicture*}(-3,-1)(3,3.5)
\parametricplotThreeD[xPlotpoints=200, yPlotpoints=100,  linecolor=cyan!30, linewidth=1pt, 
        plotstyle=curve, algebraic=true, fillstyle=solid, fillcolor=cyan!30, opacity=0.5]
        (0,3)(0, 6.2831853){cos(u) | sin(u) | t}   %% the cylinder x^2 + y^2 = 1
    
\pstThreeDCircle[linewidth=1pt,linecolor=blue](0,0,3)(1,0,0)(0,1,0)     
\pstThreeDCircle[linewidth=1pt,linecolor=blue](0,0,0)(1,0,0)(0,1,0)     
\pstThreeDCircle[linewidth=1pt,linecolor=blue,linestyle=dashed,
    dash=3pt 2pt](0,0,1.5)(1,0,0)(0,1,0)        
                                    
\pstThreeDCoor[linecolor=black,linewidth=1pt,IIIDxTicksPlane=xz, 
   IIIDyTicksPlane=yz,spotX=180,xMin=-2,xMax=2,yMin=-2,yMax=2,
   zMin=-1,zMax=3.5,nameX=$x$, nameY=$y$, nameZ=$z$, labels=none]

\pstThreeDSquare[linewidth=1pt,linecolor=orange!30,fillstyle=solid,fillcolor=orange!30,opacity=0.5]
    (-2,-2,1.5)(4,0,0)(0,4,0)
\end{pspicture*}
    
\end{document}

And the same with pst-solides3d:

\DocumentMetadata{}
\documentclass[pstricks]{standalone}
\usepackage{pst-solides3d}
\begin{document}
    
\begin{pspicture}[solidmemory](-5,-4)(5,6)
\psset{Decran=15,viewpoint=10 10 5}
\psSolid[object=cylindrecreux, h=3,r=2, fillcolor=blue!10, 
     mode=4, incolor=green!50, linecolor=black!10,name=A,action=none](0,0,0)
\psSolid[object=plan,definition=equation,args={[0 0 1 -1.5]},base=-3 3 -3 3,
     ngrid=30 30,fillcolor=red!10,linewidth=0pt,name=B,action=none]
\psSolid[object=fusion,base=A B_s,linewidth=0.1pt,action=draw**,opacity=0.9]
\axesIIID(2,2,3)(4,4,4)
\defFunction[algebraic]{Circle}(t){2*cos(t)}{2*sin(t)}{3}
\psSolid[object=courbe,r=0,function=Circle,range=0 6.3,linecolor=red,linewidth=1.5pt,action=draw]
\defFunction[algebraic]{Circle}(t){2*cos(t)}{2*sin(t)}{1.5}
\psSolid[object=courbe,r=0,function=Circle,range=-0.75 2,linecolor=red,
    linewidth=1.5pt,action=draw]
\defFunction[algebraic]{Circle}(t){2*cos(t)}{2*sin(t)}{0}
\psSolid[object=courbe,r=0,function=Circle,range=-0.75 2,linecolor=red,
    linewidth=1.5pt,action=draw]

\end{pspicture}

\end{document}

enter image description here

1
  • Shouldn't the z axis not disappear behind the plane only at the edge? Maybe the two back edges should be drawn behind, since they're not transparent?
    – cfr
    Commented Nov 18, 2023 at 5:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .