# Some extensions to pst-solides3d

I asked this set of questions (actually 2 of the 3 below) on the PSTricks mailing list a couple of days ago, but have since heard that Herbert's "to do" list is quite lengthy. So, I'm distributing them to a wider audience here, in hopes of getting some feedback...

Consider the following minimal example:

\documentclass{article}
\usepackage{multido}%
\usepackage{pst-solides3d}%
\pagestyle{empty}
\begin{document}
\begin{pspicture}(-4,-4)(10,10)
\psset{viewpoint=50 45 20 rtp2xyz,Decran=25,lightsrc=50 45 20,lightintensity=1}%

% ================== SPHERE ==================
\psSolid[%
object=calottesphere,% sphere
theta=90,phi=-90,% angles between which to draw the hollow spherical section
ngrid=45 45,% number of grid lines across 2 dimensions r
grid,% remove line edges
fillcolor=black!15,%
incolor=black!15,%
hollow=true,% object has a hollow look
action=draw**](0,0,0)% draw the object

% ================== SECTION CURVE ==================
% pi/2~1.5707963267948966192313216916398
% pi/30~0.10471975511965977461542144610932
% pi/15~0.20943951023931954923084289221863
% pi/6~0.52359877559829887307710723054658
% r=3.5*sin(45)~2.4748737341529
% x=r*cos(t), y=r*sin(t), z={2.4748737341529,4.4748737341529}
\defFunction[algebraic]%
{sectioncut}(t)%
{3.5*cos(0.5236)*cos(t)}{3.5*cos(0.5236)*sin(t)}{3.5*sin(0.5236)}%
\multido{\rA=0.0+0.2094,\rB=0.1047+0.2094}{15}{%
\psSolid[%
object=courbe,% object is a curve
r=0,% with of curve line is 0
range=\rA\space \rB,%
linecolor=black,%
linewidth=0.5\pslinewidth,%
resolution=360,%
RotZ=-45,%
function=sectioncut]%
}%
\end{pspicture}
\end{document}


It produces this sphere and dashed line segment:

Since I am unfamiliar with fiddling around in the guts of packages, I am not sure whether my questions are at all reasonable, or perhaps just too far-fetched. However, asking is free, right? Riiight...

Question 1: Is it possible to change the default shadow colour from black to something else?

My motivation for this question stems from the fact that the shadow of the object from the light source (lightsrc) depends on the specified viewpoint parameter, and could potentially be solid black. Consequently, in an attempt to reduce the shadow intensity, lightsrc and viewpoint could be chosen closer together. However, the package documentation suggests against this by stating the following (on page 16):

Note: In order to get some shadow regions to appear in the graphic — which emphasises the 3D character — we would suggest choosing the light source and the view point differently.

So, in order to heed this note, it would be ideal to have/use an option like shadowcolor=black!50 (say). On that thought - and here I'm going for gold - how about an option like lightsrccolor=green!50!red (say) for those festive times when you're really screwing around with different-coloured light bulbs.

Question 2: Is it possible to create a dashed line style (linestyle=dashed) for a parametric curve in 3D (object=courbe)?

Although the section curve in the graphic looks like a dashed line, it actually uses the multido package to sequentially print 15 solid line segments of a parametric curve along intervals of pi (pi/15~0.2094 to more accurate). However, I think this artificially bloats the resulting EPS/PDF since each of the (15) line segments is considered its own \psSolid[object=courbe,...].

Question 3: pst-solides3d provides the option opacity=k where 0<=k<=1 which sets the fill opacity of a surface. Is it possible to add a similar option for stroke opacity?

This option stems from playing around with PSTricks' options for opacity: strokeopacity (for normal stroke operation) and opacity (for filled areas).

-

For objects which should test if visible or not it is not possible with linestyle=dashed because all line segments are in general shorter than the ones from the dash and they will be sorted before drawn. However, you can delete some segments from such a line:

\documentclass{article}
\usepackage{pst-solides3d}
\pagestyle{empty}
\begin{document}
\begin{pspicture}(-4,-4)(10,10)
\psset{viewpoint=50 45 20 rtp2xyz,Decran=25,lightsrc=viewpoint,lightintensity=1.25}
\psSolid[object=sphere,r=3.5,ngrid=30 30,hue =0 0.5,grid=false]
\defFunction[algebraic]{sectioncut}(t)
{3.5*cos(0.5236)*cos(t)}
{3.5*cos(0.5236)*sin(t)}
{3.5*sin(0.5236)}
\psSolid[object=courbe,r=0,range=-0.75 2.5,resolution=90,
rm=1 2 88{} for, % delete every second segment
function=sectioncut]
\end{pspicture}
\end{document}


strokeopacity in general should work and the shadowcolor cannot be modified by now.

-
Thanks Herbert. I'm looking forward to when light and shadow colours could be incorporated into pst-solides3d. –  Werner Sep 30 '12 at 5:14