从 pst-solides3d “躺着” 绘制圆柱体

从 pst-solides3d “躺着” 绘制圆柱体

我想画一个连接赫伯特答案中的两个上部球体的“水平”圆柱体这里

我已经看过pst-solides3d手动的但我不知道该怎么做。

我怎么做?

答案1

无需定义参数函数。只需旋转圆柱体:

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

在此处输入图片描述

答案2

默认圆柱体形状为垂直。与倾斜圆柱体一样,您必须使用参数函数指定水平圆柱体。它们如下(没有球):

在此处输入图片描述

\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与对角圆柱体相关联,与FIVb水平圆柱体相关联。参数函数FIVb(t)=(x(t),y(t),z(t))具有固定的xz坐标。只有y坐标会发生变化,使其水平放置。


以下是以更高分辨率(或)看到的整个结构ngrid,包括球:

在此处输入图片描述

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

相关内容