 %
% Examples to test SpecialHost PostScript support.
% by Giuseppe Ghibò <ghibo@galileo.polito.it>
%
\documentstyle[epsf,psfig,texdraw,12pt]{article}
\input{txdtools}

\textwidth 472pt
\textheight 648pt
\topskip 10pt
\oddsidemargin -9.5pt
\evensidemargin \oddsidemargin
\topmargin -6.05pt
\headheight 12pt
\headsep 24pt
\footheight 12pt
\footskip 24pt
\columnsep 12pt
\columnwidth 230pt
\def\<#1>{{$\langle$\it#1\/$\rangle$}}

\begin{document}

\begin{titlepage}
\title{Some PostScript examples for SpecialHost\\
      {\normalsize\rm  Version 1.26}}
\author{Giuseppe Ghib\`o\\ \<ghibo@galileo.polito.it>}
\maketitle
\thispagestyle{empty}
\end{titlepage}

\section{Some samples}
\noindent Here is an example of PostScript figure inside text. The figure
is `{\epsfysize=9pt\epsffile{coil.eps}}'; another figure is your
`golfer.eps'.
\begin{verbatim}
\begin{figure}[h]
\centering
\epsfysize = 10cm
\fboxsep=0pt
\fbox{\epsffile{golfer.eps}}
\end{figure}
\end{verbatim}

\begin{figure}[h]
\centering
\epsfysize = 10cm
\fboxsep=0pt
\fbox{\epsffile{golfer.eps}}
\end{figure}


\newpage
\noindent We may also specify a bounding box to isolate a part of a picture
(acting as a viewport). For instance:
\begin{verbatim}
\begin{figure}[h]
\centering
\epsfysize = 10cm
\epsfclipon
\fboxsep=0pt
\fbox{\epsffile[250 530 350 630]{golfer.eps}}
\end{figure}
\end{verbatim}

\begin{figure}[h]
\centering
\epsfysize = 10cm
\epsfclipon
\fboxsep=0pt
\fbox{\epsffile[250 530 350 630]{golfer.eps}}
\end{figure}

\newpage
\noindent We may have rotated pictures. For instance:
\begin{verbatim}
\begin{figure}[h]
\centering
\unitlength=1bp
\fboxsep=0pt
\fbox{\begin{picture}(271.02,271.02)(0,0)
\put(0,0){\special{psfile=golfer.eps llx=250 lly=530 urx=350 ury=630 %
rwi=1984 hoffset=99.2 voffset=271.02 angle=240 clip}}
\end{picture}}
\end{figure}
\end{verbatim}

\begin{figure}[h]
\centering
\unitlength=1bp
\fboxsep=0pt
\fbox{\begin{picture}(271.02,271.02)(0,0)
\put(0,0){\special{psfile=golfer.eps llx=250 lly=530 urx=350 ury=630 %
rwi=1984 hoffset=99.2 voffset=271.02 angle=240 clip}}
\end{picture}}
\end{figure}

\newpage
\noindent Here is an example of four IFF picture having the same
name, i.e. ``{\tt europe.iff}''; note that every picture may have its
own dumped file.

\begin{figure}[h]
\centering
\unitlength=1mm
\fboxsep=0pt
\tabcolsep=0.25cm
\begin{tabular}{cc}
%
\fbox{\begin{picture}(70,67.13)
\put(0,0){\special{ifffile=europe.iff hsize=7cm vsize=6.713cm mode=ordered}}
\end{picture}}
%
&\fbox{\begin{picture}(70,67.13)
\put(0,0){\special{ifffile=europe.iff hsize=7cm vsize=6.713cm mode=ordered invert=on}}
\end{picture}}\\[.5cm]
%
\fbox{\begin{picture}(70,67.13)
\put(0,0){\special{ifffile=europe.iff hsize=7cm vsize=6.713cm mode=fs}}
\end{picture}}
%
&\fbox{\begin{picture}(70,67.13)
\put(0,0){\special{ifffile=europe.iff hsize=7cm vsize=6.713cm mode=hexagon}}
\end{picture}}
\end{tabular}
\end{figure}

\noindent The example above was produced with

\begin{verbatim}
\begin{figure}[h]
\centering
\unitlength=1mm
\fboxsep=0pt
\tabcolsep=0.25cm
\begin{tabular}{cc}
%
\fbox{\begin{picture}(70,67.13)
\put(0,0){\special{ifffile=europe.iff hsize=7cm vsize=6.713cm mode=ordered}}
\end{picture}}
%
&\fbox{\begin{picture}(70,67.13)
\put(0,0){\special{ifffile=europe.iff hsize=7cm vsize=6.713cm mode=ordered %
invert=on}}
\end{picture}}\\[.5cm]
%
\fbox{\begin{picture}(70,67.13)
\put(0,0){\special{ifffile=europe.iff hsize=7cm vsize=6.713cm mode=fs}}
\end{picture}}
%
&\fbox{\begin{picture}(70,67.13)
\put(0,0){\special{ifffile=europe.iff hsize=7cm vsize=6.713cm mode=hexagon}}
\end{picture}}
\end{tabular}
\end{figure}
\end{verbatim}

\newpage
Here is the PostScript picture of page 1, breaked into six small
pictures.

\begin{figure}[h]
\centering
\def\sz{\epsfclipon\epsfxsize=3.5cm}
\fboxsep=0pt
\tabcolsep=0.25cm
%
\begin{tabular}{cc}
\fbox{\sz\epsffile[7 495 292 726]{golfer.eps}}
&\fbox{\sz\epsffile[292 495 577 726]{golfer.eps}}\\[0.5cm]
%
\fbox{\sz\epsffile[7 263 292 495]{golfer.eps}}
&\fbox{\sz\epsffile[292 263 577 495]{golfer.eps}}\\[0.5cm]
%
\fbox{\sz\epsffile[7 31 292 263]{golfer.eps}}
&\fbox{\sz\epsffile[292 31 577 263]{golfer.eps}}
\end{tabular}
\end{figure}

\noindent The pictures above are obtained with:
\begin{verbatim}
\begin{figure}[h]
\centering
\def\sz{\epsfclipon\epsfxsize=3.5cm}
\fboxsep=0pt
\tabcolsep=0.25cm
%
\begin{tabular}{cc}
\fbox{\sz\epsffile[7 495 292 726]{golfer.eps}}
&\fbox{\sz\epsffile[292 495 577 726]{golfer.eps}}\\[0.5cm]
%
\fbox{\sz\epsffile[7 263 292 495]{golfer.eps}}
&\fbox{\sz\epsffile[292 263 577 495]{golfer.eps}}\\[0.5cm]
%
\fbox{\sz\epsffile[7 31 292 263]{golfer.eps}}
&\fbox{\sz\epsffile[292 31 577 263]{golfer.eps}}
\end{tabular}
\end{figure}
\end{verbatim}

\newpage
Now complete this puzzle...

\begin{figure}[h]
\centering
\def\sz{\epsfclipon\epsfxsize=3.5cm}
\fboxsep=0pt
\tabcolsep=0.25cm
%
\begin{tabular}{cc}
\fbox{\sz\epsffile[292 263 577 495]{golfer.eps}}
&\fbox{\sz\epsffile[7 31 292 263]{golfer.eps}}\\[0.5cm]
%
\fbox{\sz\epsffile[292 31 577 263]{golfer.eps}}
&\fbox{\sz\epsffile[292 495 577 726]{golfer.eps}}\\[0.5cm]
%
\fbox{\sz\epsffile[7 263 292 495]{golfer.eps}}
&\fbox{\sz\epsffile[7 495 292 726]{golfer.eps}}
\end{tabular}
\end{figure}

\newpage
\noindent We may have also picture with unknown size or wrong Bounding Box
(a size of 8$\times$11" will be used instead). For example:
\begin{verbatim}
\begin{figure}[h]
\centering
\fboxsep=0pt
\fbox{%
\setlength{\unitlength}{0.1bp}
\begin{picture}(4320,2592)(0,0)
\footnotesize
\put(937,1363){\makebox(0,0){$R_4\,{p_4t}$}}
\put(2766,390){\makebox(0,0){$R_1\,{p_1t}$}}
 .
 .
 .
\put(0,0){\special{psfile=graph.eps}}
\end{picture}}
\end{figure}
\end{verbatim}

\begin{figure}[h]
\centering
\fboxsep=0pt
\fbox{%
\setlength{\unitlength}{0.1bp}
\begin{picture}(4320,2592)(0,0)
\footnotesize
\put(937,1363){\makebox(0,0){$R_4\,{p_4t}$}}
\put(2766,390){\makebox(0,0){$R_1\,{p_1t}$}}
\put(2766,1073){\makebox(0,0){$R_2\,{p_2t}$}}
\put(3680,1414){\makebox(0,0)[l]{$R_3\,{p_3t}$}}
\put(3680,1653){\makebox(0,0)[r]{$\theta_2(t)$}}
\put(2766,2029){\makebox(0,0)[r]{$R_5\,{p_5t}$}}
\put(4137,51){\makebox(0,0){$t\,[s]$}}
\put(3223,51){\makebox(0,0){0,15}}
\put(2309,51){\makebox(0,0){0,10}}
\put(1394,51){\makebox(0,0){0,05}}
\put(480,51){\makebox(0,0){0}}
\put(420,2541){\makebox(0,0)[r]{$4$}}
\put(420,2200){\makebox(0,0)[r]{$3$}}
\put(420,1858){\makebox(0,0)[r]{$2$}}
\put(420,1517){\makebox(0,0)[r]{$1$}}
\put(420,1175){\makebox(0,0)[r]{$0$}}
\put(420,834){\makebox(0,0)[r]{$-1$}}
\put(420,492){\makebox(0,0)[r]{$-2$}}
\put(420,151){\makebox(0,0)[r]{$-3$}}
\put(0,0){\special{psfile=graph.eps}}
\end{picture}}
\end{figure}

\newpage
Here is a figure created with \TeX draw.
\begin{figure}
\begin{center}
%
\begin{texdraw}
%
\drawdim cm
\arrowheadtype t:F
\arrowheadsize l:0.2 w:0.1
%
\def\linesthin{\linewd 0.01
}
\def\linesmedium{\linewd 0.02
}
\def\linesthick{\linewd 0.04
}
%
\def\bdot{\fcir f:0 r:0.05 }
%
\def\cradius{0.2}
%
\def\lvectoc (#1 #2)[#3]{%
\currentpos \xa\ya
\cossin ({\xa} \ya)(#1 #2)\cosa\sina
\savepos (#1 #2)(*tx *ty)%
\bsegment
  \move (*tx *ty)%
  \setsegscale {#3}
  \rmove ({-\cosa} -\sina)%
  \savecurrpos (*ex *ey)%
\esegment
\lvec (*ex *ey)%
\move (#1 #2)}
%
\def\lvecfrc (#1 #2)[#3]{%
\currentpos \xa\ya
\cossin ({\xa} \ya)(#1 #2)\cosa\sina
\bsegment
  \setsegscale {#3}
  \move ({\cosa} {\sina})%
  \savecurrpos (*ex *ey)%
\esegment
\move (*ex *ey)%
\lvec (#1 #2)}
%
\def\lvecfrctoc (#1 #2)[#3 #4]{%
\currentpos \xa\ya
\cossin ({\xa} \ya)(#1 #2)\cosa\sina
\bsegment
  \setsegscale {#3}
  \move ({\cosa} \sina)%
  \savecurrpos (*ex *ey)%
\esegment
\move (*ex *ey)%
\lvectoc (#1 #2)[#4]}
%
\def\coilbeg#1{%
\bsegment
  \setsegscale {#1}
  \move (0 0)
  \clvec (0 0.2)(0.2 0.5)(0.35 0.5)
  \clvec (0.5 0.5)(0.6 0.3)(0.6 -0.1)
  \clvec (0.6 -0.35)(0.525 -0.5)(0.45 -0.5)
  \clvec (0.4 -0.5)(0.35 -0.25)(0.525 0.2)
  \savepos (0.6 0)(*ex *ey)
\esegment
\move (*ex *ey)}
%
\def\coilmed#1{%
\bsegment
  \setsegscale {#1}
  \move (0 0.3)
  \clvec (0.075 0.425)(0.175 0.5)(0.25 0.5)
  \clvec (0.4 0.5)(0.5 0.3)(0.5 -0.1)
  \clvec (0.5 -0.35)(0.425 -0.5)(0.35 -0.5)
  \clvec (0.3 -0.5)(0.25 -0.25)(0.425 0.2)
  \savepos (0.5 0)(*ex *ey)
\esegment
\move (*ex *ey)}
%
\def\coilend#1{%
\bsegment
  \setsegscale {#1}
  \move (0 0.3)
  \clvec (0.075 0.425)(0.175 0.5)(0.25 0.5)
  \clvec (0.4 0.5)(0.5 0.3)(0.5 0)
  \savepos (0.5 0)(*ex *ey)
\esegment
\move (*ex *ey)}
%
\def\coil#1{%
\coilbeg{#1}
\coilmed{#1}\coilmed{#1}\coilmed{#1}
\coilend{#1}}
%
\def\semicircle#1{%
\larc r:{#1} sd:0 ed:180
\bsegment
\setsegscale 0.2
\move (0 0) \rlvec ({#1} 0)
\move (0 0) \rlvec ({-#1} 0)
\move (0 0) \rlvec (0 {#1})
\move (0 0) \rlvec (0 {-#1})
\esegment}
%
\def\torque#1#2{
\bsegment
  \setsegscale {#1}
  \linesthin
  \larc r:1 sd:45 ed:135
  \move (-0.7071 0.7071)
  \ravec (-0.01 -0.01)
  \move (-0.92 .92) \textref h:C v:B \htext{#2}
\esegment}
%
\def\cross#1{%
\bsegment
  \setsegscale{#1}
  \move (0.5 0)
  \rlvec (-1 0)
  \move (0 0.5)
  \rlvec (0 -1)
\esegment}
%
\def\damper#1{%
\bsegment
  \setsegscale {#1}
  \move (0 -0.5)
  \rlvec (0 1)
  \rlvec (1.1 0)
  \move (0 -0.5)
  \rlvec (1.1 0)
  \move (0.8 0)
  \rlvec (0 0.4)
  \rlvec (-0.1 0)
  \rlvec (0 -0.8)
  \rlvec (0.1 0)
  \rlvec (0 0.4)
  \lfill f:0
  \savepos (0.8 0)(*ex *ey)
  \move (0.55 -0.7)
  \textref h:C v:T \htext{$\beta$}
\esegment
\move (*ex *ey)}
%
\def\dashzero#1{%
\bsegment
  \setsegscale {#1}
  \move (-0.7071 -0.7071)
  \lvec (0.7071 0.7071)
\esegment}
%
\def\dashone#1{%
\bsegment
  \setsegscale {#1}
  \move (-0.2249 -0.9744)
  \lvec (0.2249 0.9744)
\esegment}
%
\def\dashtwo#1{
\bsegment
  \setsegscale {#1}
  \move (-0.2875 -0.9578)
  \lvec (0.2875 0.9578)
\esegment}
%
\linesmedium
%
\def\nodeAx{5.5}  \def\nodeAy{0}
\def\nodeBx{-1.5} \def\nodeBy{6.5}
\def\nodeCx{-1.5} \def\nodeCy{5}
\def\radiusone{0.5}
\def\radiustwo{0.3}
\def\radiussem{0.4}
%
\move (0 0)
\semicircle{\radiussem}
\torque{1.1}{$C_1$}
%
\linesthick
\lvecfrctoc ({\nodeCx} {\nodeCy})[0.41 {\radiusone}]
%
\linesmedium
\lcir r:{\radiusone}
%
\move (-0.3 0)
\rlvec (-2 0)
\move (0.3 0)
\lvec (5.2 0)
%
\linesthin
\move (0 0)
\larc r:2 sd:90 ed:101
\move (-0.380 1.963)
\avec (-0.575 1.916)
\move (-0.3 2.2) \textref h:C v:B \htext{$\theta_1$}
\move (0 0)
\lvecfrc (0 2.3)[\radiussem]
%
\linesmedium
\move ({\nodeCx} {\nodeCy})
{\bsegment
\setsegscale{\radiusone}
\move (0 1.2)
\textref h:C v:B \htext{$m_1$}
\esegment}
%
\linesmedium
\move ({\nodeCx} {\nodeCy})
\cross{0.2}
%
\linesthin
\rmove (0 -0.35)
\ravec (0 -2)
\rmove (-0.1 0.25)
\textref h:R v:B \htext{$f_1$}
%
\move (0 0)
\linesthin
\lvecfrc (-1.6 -0.48)[0.2]
\move ({\nodeCx} {\nodeCy})
\lvecfrc (-3.1 4.52)[0.3]
\move (-1.3 -0.39)
\dashtwo{0.1}
\lvec (-2.8 4.61)
\dashtwo{0.1}
\move (-2.15 2.2)
\textref h:R v:T \htext{$h_1$}
%
\move (-1.05 3.5)
\bdot
\linesmedium
\rlvec (1.5 0)
\rmove (0 -0.5)
\rlvec (0 1)
\rlvec (0.8 0)
\coil{0.5}
\rlvec (0.8 0)
\savecurrpos (*tmpax *tmpay)
\rlvec (0 -1)
\rmove (0 0.5)
\lvec (4.692 3.5)
\move (2 4.4)
\textref h:C v:B \htext{$k$}
%
\move (-1.05 3.5)
\rmove (1.5 -0.5)
\rlvec (1.065 0)
\savecurrpos (*tmpbx *tmpby)
\damper{0.7}
\lvec (*tmpax *tmpby)
%
\linesthin
\move (0 0)
\rmove (0 -0.2)
\rlvec (0 -0.8)
\rmove (0 0.2)
\dashzero{0.1}
\rlvec ({\nodeAx} 0)
\move ({\nodeAx} {\nodeAy})
\rmove (0 -0.2)
\rlvec (0 -0.8)
\rmove (0 0.2)
\dashzero{0.1}
\move (2.75 -0.7) \textref h:C v:B \htext{$d$}
%
\move ({\nodeAx} {\nodeAy})
{
\bsegment
\linesmedium
\semicircle{\radiussem}
\torque{1.1}{$C_2$}
%
\linesthick
\lvecfrctoc ({\nodeBx} {\nodeBy})[0.41 {\radiustwo}]
%
\linesmedium
\lcir r:{\radiustwo}
\move (0.3 0)
\rlvec (2 0)
%
\linesthin
\move (0 0)
\larc r:2 sd:90 ed:103
\move (-0.416 1.956)
\avec (-0.45 1.949)
\move (-0.25 2.2) \textref h:C v:B \htext{$\theta_2$}
\move (0 0)
\lvecfrc (0 2.3)[\radiussem]
%
\linesmedium
\move ({\nodeBx} {\nodeBy})
{
\bsegment
\setsegscale{\radiustwo}
\move (0 1.3) \textref h:C v:B \htext{$m_2$}
\esegment
}
%
\linesthin
\move (0 0)
\lvecfrc (2.92 0.675)[0.6]
\move ({\nodeBx} {\nodeBy})
\lvecfrc (1.42 7.175)[0.2]
\move (2.631 0.607)
\dashone{0.1}
\lvec (1.131 7.107)
\dashone{0.1}
%
\linesmedium
\move (2 3.7) \textref h:L v:B \htext{$h_2$}
\move ({\nodeBx} {\nodeBy})
\cross{0.2}
%
\move (0 0)
\rmove (-0.808 3.5)
\bdot
%
\linesthin
\rlvec (2.3 0)
\rmove (-0.3 0)
\dashzero{0.1}
\rlvec (0 -3.5)
\dashzero{0.1}
\rmove (0.1 1.75) \textref h:L v:C \htext{$h$}
%
\linesthin
\move ({\nodeBx} {\nodeBy})
\rmove (0 -0.15)
\ravec (0 -2)
\rmove (-0.1 0.25) \textref h:R v:B \htext{$f_2$}
\esegment
}
%
\end{texdraw}
%
\end{center}
\caption{A simple \TeX draw picture.}
\end{figure}

\newpage
\psfig{figure=graybox.eps,rheight=0cm,rwidth=0cm,%
height=3.3cm,width=\hsize,silent=}
This is an example of a psfig picture. As you can see we are writing on
a gray background produced by a PostScript file. The following \verb+\psfig+
macro was used to include the PostScript file.
\begin{verbatim}
\psfig{figure=graybox.eps,rheight=0cm,rwidth=0cm,%
height=3.3cm,width=\hsize,silent=}
\end{verbatim}

\newpage
Starting since SpecialHost v1.26 it is possibile to show even
PostScript pictures created with MetaPost. Note that if the
MetaPost graphic contains text labels, the Bakoma Type-1 font
collection is needed\footnote{The Bakoma Type-1 font collection
is a collection of CM fonts in Type-1 form and it is available
at CTAN archives.} to show the correct fonts.

\begin{figure}
\centering
\fbox{\epsffile{mpsamp1.1}}
\caption{A Metapost figure.}
\end{figure}

\end{document}
