# Fill colour for ring (pstricks)

I have a drawing for a cylinder and have filled in the ring section with light gray.

However, because my background is light orange, the image turns out to be a bit weird.

Here is the image:

Here is my code:

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


Another PSTricks solution:

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


It is the choice of the perspective that is bad. Here is an example with 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}

• Just a little thing: the dot in the middle should be 3D, it would be less confusing for the human brain when it tries to place it in the correct place in the 3D space. – yo' Mar 7 '15 at 16:19