填充环的颜色(pstricks)

填充环的颜色(pstricks)

我有一张圆柱体的图纸,并用浅灰色填充了环部分。

但是,由于我的背景是浅橙色,所以图像看起来有点奇怪。

以下是图片:

在此处输入图片描述

这是我的代码:

    \begin{figure}[H]
\centering
\psset{xunit=1.0cm,yunit=1.0cm,algebraic=true,dimen=middle,dotstyle=o,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\begin{pspicture*}(-5.03999786579,-2.60435804065)(9.52396200612,6.62258178636)
\pscircle[fillcolor=lightgray,fillstyle=solid](-2.17742644269,0.466153228618){2.53961608687}
\pscircle[fillcolor=white,fillstyle=solid](-2.17742644269,0.466153228618){2.05904260258}
\psline(-3.15956373091,2.80817291593)(4.45168632659,5.71420083763)
\psline(-1.20065102466,-1.87810777464)(6.41205030135,1.02847425142)
\parametricplot{-1.177820125593466}{1.9703016360052805}{1.*2.53948165422*cos(t)+0.*2.53948165422*sin(t)+5.43958261193|0.*2.53948165422*cos(t)+1.*2.53948165422*sin(t)+3.37437997525}
\parametricplot[linestyle=dotted]{1.9703016360052805}{5.10536518158612}{1.*2.53982297387*cos(t)+0.*2.53982297387*sin(t)+5.43958261193|0.*2.53982297387*cos(t)+1.*2.53982297387*sin(t)+3.37437997525}
\pscircle[linestyle=dotted](5.43958261193,3.37437997525){2.05992773607}
\psline[linestyle=dotted](-2.97422018908,2.36477803751)(4.6369046976,5.27148578244)
\psline[linestyle=dotted](-1.3859945665,-1.43471289623)(6.2269636645,1.4708744313)
\psline[linestyle=dashed,dash=3pt 3pt](-2.17742644269,0.466153228618)(-1.56471932744,2.43192189002)
\psline[linestyle=dashed,dash=3pt 3pt](-2.17742644269,0.466153228618)(0.202564742151,-0.420013701907)
\rput[tl](-1.92632368628,-0.0862728354885){8 cm}
\rput[tl](-2.87963195551,1.7969978376){5 cm}
\rput[tl](-0.168604391391,4.93578229275){14 cm}
\psdots[dotstyle=*](-2.17742644269,0.466153228618)
\rput[bl](-2.67698534012,0.316814882465){{$O$}}
\end{pspicture*}
\end{figure}

请帮忙。谢谢。

答案1

另一个 PSTricks 解决方案:

\documentclass[pstricks]{standalone}
\usepackage{pst-solides3d}
\begin{document}

\begin{pspicture}(-4,-4)(4,4)
\psset{lightsrc=viewpoint,viewpoint=100 20 20 rtp2xyz,Decran=50,shortput=nab}
\psSolid[object=anneau,h=12,ngrid=72 4,grid,fillcolor={[hsb]{0.118 1 1}},R=5,r=4,
    incolor=green!50,RotY=90]
\psSolid[object=anneau,h=0.1,ngrid=72 4,grid,fillcolor=red,R=5,r=4,
    incolor=green!50,RotY=90](6,0,0)
\psPoint(6,0,0){O}\psdot(O)
\psPoint(6,5 120 cos mul,5 120 sin mul){Ext}
\pcline{->}(O)(Ext)_[nrot=:D]{R1}
\psPoint(6,4 30 cos mul,4 30 sin mul){Int}
\pcline{->}(O)(Int)^[nrot=:U]{R2}
\end{pspicture}

\end{document}

在此处输入图片描述

答案2

视角的选择很糟糕。下面是 pst-solides3d 的示例。 在此处输入图片描述

\documentclass{article}
\usepackage{pst-solides3d}
\begin{document}
\begin{center}
\begin{pspicture}(-4,-2)(4,10)
\psset{lightsrc=viewpoint,viewpoint=100 20 20 rtp2xyz,Decran=50,solidmemory}
\psSolid[object=prisme,h=12,grid,
fillcolor={[hsb]{0.118 1 1}},
base=0 5 360 { % 72 faces extérieurs 360/5
/angle ED
 5 angle cos mul
 5 angle sin mul
} for
360 -5 0 { % 72 faces intérieures
/angle ED
4 angle cos mul
4 angle sin mul
} for,
fcol=0 (red) 72 1 144 {/i ED i (cyan)} for,
RotY=90]
\defFunction[algebraic]{cercle1}(t){5*cos(t)}{5*sin(t)}{}
\defFunction[algebraic]{cercle2}(t){4*cos(t)}{4*sin(t)}{}
\psSolid[object=plan,
   definition=equation,
   args={[1 0 0 -12]},
   base=-10 10 -10 10,
   action=none,
   name=monplan]
\psset{plan=monplan}
\psProjection[object=courbeR2,
   range=0 2 Pi mul,resolution=360,
   function=cercle2]
\psProjection[object=courbeR2,
   range=0 2 Pi mul,resolution=360,
   function=cercle1]
\composeSolid
\psPoint(12,0,0){O}\psdot(O)
\psPoint(12,5 120 cos mul,5 120 sin mul){Ext}
\psline{->}(O)(Ext)
\pcline(Ext)(O)
\aput{:U}{R1}
\psPoint(12,4 30 cos mul,4 30 sin mul){Int}
\pcline{->}(O)(Int)
\aput{:U}{R2}
\end{pspicture}
\end{center}
\end{document}

相关内容