I would like to draw a 'horizontal' cylinder connecting the two upper spheres from Herbert's answer here.
I have looked at the pst-solides3d
manual but I cannot find out how to do that.
How do I do that?
I would like to draw a 'horizontal' cylinder connecting the two upper spheres from Herbert's answer here.
I have looked at the pst-solides3d
manual but I cannot find out how to do that.
How do I do that?
no need for defining a parametric function. Simply rotate the cylinder:
\documentclass{article}
\usepackage{pst-solides3d}
\psset{lightsrc=viewpoint,viewpoint=80 10 10 rtp2xyz,Decran=40}
\begin{document}
\begin{pspicture}[solidmemory](-4,-4)(14,14)
\psset{object=sphere,r=2,fillcolor=red!25,action=none}
\psSolid[object=cylindre,h=6,r=0.5,fillcolor=yellow,name=C](0,0,0)
\psSolid[name=S1](0,0,0)
\psSolid[name=S2](0,0,6)
\psSolid[name=S3](0,6,6)
\psSolid[object=cylindre,h=8,r=0.5,RotX=-45,
fillcolor=black!20,name=L1]
\psSolid[object=cylindre,h=6,r=0.5,RotY=90,RotZ=90,
fillcolor=green!20,name=L2](0,0,6)
\psSolid[object=fusion,base=S1 S2 S3 C L1 L2,linewidth=0.2pt,action=draw**]
\end{pspicture}
\end{document}
$TEXMF/doc/latex/pstricks-examples/
texdoc
refers only to the main documentation. And the quick ref is an additional documentation, like the other ones. What do you mean by "english contents"?
The default cylinder shape is vertical. Like the slanted one, you have to specify the horizontal one using a parametric function. Here they are (without the balls):
\documentclass{article}
\usepackage{pst-solides3d}% http://ctan.org/pkg/pst-solides3d
\psset{lightsrc=viewpoint,viewpoint=80 10 10 rtp2xyz,Decran=40}
\begin{document}
\begin{pspicture}[solidmemory](-4,-4)(14,14)
\psset{object=sphere,r=2,fillcolor=red!25,action=none}
\psSolid[object=cylindre,h=6,r=0.5,fillcolor=yellow,name=C](0,0,0)
%\psSolid[name=S1](0,0,0)
%\psSolid[name=S2](0,0,6)
%\psSolid[name=S3](0,6,6)
\defFunction[algebraic]{FIVa}(t){0}{t}{t}% x(t)=0, y(t)=t, z(t)=t
\psSolid[object=courbe,range=0 6,ngrid=16 16,function=FIVa,r=0.5,
fillcolor=black!20,name=L1]
\defFunction[algebraic]{FIVb}(t){0}{t}{6}% x(t)=0, y(t)=t, z(t)=6
\psSolid[object=courbe,range=0 6,ngrid=16 16,function=FIVb,r=0.5,
fillcolor=green!50,name=L2]
%
\psSolid[object=fusion,base=C L1 L2,linewidth=0.2pt,action=draw**]
\end{pspicture}
\end{document}
FIVa
is associated with the diagonal cylinder, and FIVb
is associated with the horizontal cylinder. The parametric function FIVb(t)=(x(t),y(t),z(t))
has a fixed x
and z
coordinate. Only the y
coordinate changes, making it lay horizontally.
Here's a take on the entire structure at a higher resolution (or ngrid
), balls included:
\documentclass{article}
\usepackage{pst-solides3d}% http://ctan.org/pkg/pst-solides3d
\psset{lightsrc=viewpoint,viewpoint=80 10 10 rtp2xyz,Decran=40}
\begin{document}
\begin{pspicture}[solidmemory](-4,-4)(14,14)
\psset{object=sphere,r=2,fillcolor=red!25,action=none,ngrid=40 40}
\psSolid[object=cylindre,h=6,r=0.5,fillcolor=yellow,name=C](0,0,0)
\psSolid[name=S1](0,0,0)
\psSolid[name=S2](0,0,6)
\psSolid[name=S3](0,6,6)
\defFunction[algebraic]{FIVa}(t){0}{t}{t}% x(t)=0, y(t)=t, z(t)=t
\psSolid[object=courbe,range=0 6,ngrid=40 40,function=FIVa,r=0.5,
fillcolor=black!20,name=L1]
\defFunction[algebraic]{FIVb}(t){0}{t}{6}% x(t)=0, y(t)=t, z(t)=6
\psSolid[object=courbe,range=0 6,ngrid=40 40,function=FIVb,r=0.5,
fillcolor=green!50,name=L2]
%
\psSolid[object=fusion,base=C L1 L2 S1 S2 S3,linewidth=1sp,action=draw**]
\end{pspicture}
\end{document}