We can also \Index{fuse solids} by passing the code directly using
\textit{jps code}. The calculation of the hidden parts is carried
out by the PostScript routines of the \texttt{solides.pro} file,
but the lines of code are ``encapsulated'' within a
\texttt{pspicture} environment thanks to the command
\verb+\codejps{ps code}+.
\subsection{Using \textit{jps code}}
\subsubsection{The choice of object}
\begin{compactitem}
\item \texttt{[section] n newanneau}: choice of a cylindrical ring defined by
the coordinates of the vertices of its intersection with the plane $Oyz$.
\item \texttt{2 1.5 6 [4 16] newcylindre}: choice of a vertical cylinder
with the following parameters:
\begin{compactitem}
\item \texttt{z0=2}: the position of the base centre on the axis $Oz$;
\item \texttt{radius=1.5}: radius of the cylinder;
\item \texttt{z1=6}: the position of the top centre on the
axis $Oz$;
\item \texttt{[4 16]}: the cylinder is sliced horizontally into 4 pieces and
vertically into 16 sectors.
\end{compactitem}
\end{compactitem}
\subsubsection{The transformations}
\begin{compactitem}
\item \texttt{\{-1 2 5 translatepoint3d\} solidtransform}: the object
previously chosen is translated to the point with the
coordinates $(x=-1,y=2,z=5)$.
\item \texttt{\{90 0 45 rotateOpoint3d\} solidtransform}: the object
previously chosen is rotated around the axes $(Ox,Oy,Oz)$, in
this order: rotation of 90$^\mathsf{o}$ about $(Ox)$ followed
by a rotation of 45$^\mathsf{o}$ about $(Oz)$.
\end{compactitem}
\subsubsection{The choice of object colour}
\begin{compactitem}
\item dup (yellow) outputcolors: a yellow object illuminated in
white light.
\end{compactitem}
\subsubsection{Fusing objects}
\begin{compactitem}
\item The \Index{fusion} is finally made with the instruction \texttt{solidfuz}.
\end{compactitem}
\subsubsection{Designing objects}
\begin{compactitem}
\item There are three drawing options:
\begin{compactitem}
\item \texttt{drawsolid}: only draw edges; hidden edges are drawn dashed;
\item \texttt{drawsolid*}: draw and fill solids in their coded order (not
a very interesting option at first glance); hidden edges are drawn dashed;
\item \texttt{drawsolid**}: draw and fill solids with the
painting algorithm; only those parts seen by the observer are
drawn.
\end{compactitem}
\end{compactitem}
\begin{center}
\psset{lightsrc=50 -50 50,viewpoint=40 16 32 rtp2xyz,Decran=40}
\psset{unit=0.4}
\begin{minipage}{0.3\linewidth}
\begin{pspicture}(-6,-5)(6,7)
\psframe*[linecolor=gray!40](-6,-5)(6,7)
\codejps{
% solide 1
/tour {
-6 1.5 6 [4 16] newcylindre
dup (jaune) outputcolors
} def
% solide 2
/anneau {
[4 -1 4 1 3 1 3 -1] 24 newanneau
{0 0 -1 translatepoint3d} solidtransform
dup (orange) outputcolors
} def
% fusion
tour anneau solidfuz
drawsolid}
\end{pspicture}
\end{minipage}
\hfill
\begin{minipage}{0.3\linewidth}
\begin{pspicture}(-6,-5)(6,7)
\psframe*[linecolor=gray!40](-6,-5)(6,7)
\codejps{
% solide 1
/tour {
-6 1.5 6 [4 16] newcylindre
dup (jaune) outputcolors
} def
% solide 2
/anneau {
[4 -1 4 1 3 1 3 -1] 24 newanneau
{0 0 -1 translatepoint3d} solidtransform
dup (orange) outputcolors
} def
% fusion
tour anneau solidfuz
drawsolid*}
\end{pspicture}
\end{minipage}
\hfill
\begin{minipage}{0.3\linewidth}
\begin{pspicture}(-6,-5)(6,7)
\psframe*[linecolor=gray!40](-6,-5)(6,7)
\codejps{
% solide 1
/tour {
-6 1.5 6 [4 16] newcylindre
dup (jaune) outputcolors
} def
% solide 2
/anneau {
[4 -1 4 1 3 1 3 -1] 24 newanneau
{0 0 -1 translatepoint3d} solidtransform
dup (orange) outputcolors
} def
% fusion
tour anneau solidfuz
drawsolid**}
\psPoint(0,0,8){Z}
\psPoint(0,0,6){Z'}
\psline[arrowsize=0.3,arrowinset=0.2]{->}(Z')(Z)
\uput[u](Z){$z$}
\end{pspicture}
\end{minipage}
\end{center}
We first define the two sulphur atoms and place them on the $Oz$
axis. $\mathrm{S_1}$ is placed at the origin $O$.
\begin{verbatim}
\codejps{
/Soufre1 {3.56 [20 16] newsphere
dup (Yellow) outputcolors} def
/Soufre2 {3.56 [20 16] newsphere
{0 0.000 20.10 translatepoint3d} solidtransform
dup (Yellow) outputcolors} def
\end{verbatim}
Then the single bond \textsf{S-O} using the following convention:
half red---the half connected to \textsf{O}, and half yellow---the half connected to \textsf{S}.
\begin{verbatim}
/LiaisonR {
7.5 0.5 15 [10 10] newcylindre
dup (Red) outputcolors
} def
/LiaisonY {
0 0.5 7.5 [10 10] newcylindre
dup (Yellow) outputcolors
} def
/Liaison{LiaisonR LiaisonY solidfuz} def
\end{verbatim}
The oxygen atom, its bond, and the setting of the combined unit:
\begin{verbatim}
/Ox {2.17 [20 16] newsphere
{0 0 15 translatepoint3d} solidtransform
dup (Red) outputcolors} def
/LO { Liaison Ox solidfuz} def
/LO1 { LO {0 -109.5 0 rotateOpoint3d} solidtransform } def
/LOx1 { LO1 {0 0 120 rotateOpoint3d} solidtransform } def
% fin liaison simple S-O
\end{verbatim}
For the double bond \textsf{S=O}, we take the single bond above
and duplicate it with shifts of 0.75~cm along the $Ox$ axis.
\begin{verbatim}
% Liaison double S=O
/LiaisonD1 {Liaison {-0.75 0 0 translatepoint3d} solidtransform} def
/LiaisonD2 {Liaison {0.75 0 0 translatepoint3d} solidtransform} def
/LiaisonDD { LiaisonD1 LiaisonD2 solidfuz} def
\end{verbatim}
Connecting it to the \textsf{O} atom:
\begin{verbatim}
/LiaisonDOx {LiaisonDD Ox solidfuz} def
\end{verbatim}
and with two successive rotations we position the two bonds
\textsf{=O}:
\begin{verbatim}
/LiaisonDOx1 {LiaisonDOx {0 -109.5 0 rotateOpoint3d} solidtransform } def
/LiaisonDOx2 {LiaisonDOx1 {0 0 -120 rotateOpoint3d} solidtransform } def
\end{verbatim}
The following step consists of fusing the two connections:
\begin{verbatim}
/LO12 { LiaisonDOx1 LiaisonDOx2 solidfuz} def
/LO123 {LO12 LOx1 solidfuz} def
\end{verbatim}
Then the single bond \textsf{S-S} is created:
\begin{verbatim}
% liaison simple S-S
/L4 { 0 0.5 20.10 [16 10] newcylindre
dup (Yellow) outputcolors
} def
\end{verbatim}
and fused with the two atoms \textsf{S-S}:
\begin{verbatim}
/S1L4{ Soufre1 L4 solidfuz} def
/S1S2L4{ S1L4 Soufre2 solidfuz} def
\end{verbatim}
The last step will be to fuse the two \textsf{S-S} and the three
\textsf{O} already equipped with their bonds:
\begin{verbatim}
/S2O3 { S1S2L4 LO123 solidfuz} def
S2O3 drawsolid**}
\end{verbatim}