# Formula for spiral for chapter decoration.

Denis Girou Denis.Girou at idris.fr
Fri Nov 12 20:16:48 CET 1999

-----------------------------------------------------------------------------
This is the PSTricks mailing list, devoted to discussions about computational
graphics in (La)TeX using the PSTricks package from Timothy van Zandt.
For help using this mailing list, see instructions at the end of message.
-----------------------------------------------------------------------------

The following message is a courtesy copy of an article
that has been posted to comp.text.tex as well.

>>>>> "John.Culleton" == John Culleton <john at ccpl.carr.org> writes:

John.Culleton> I am fooling with "bookends" for chapter titles in fiction.
John.Culleton> I wonder if any math-literate person out there has the formula
John.Culleton> for an increasing spiral around a point. I have in mind a symbolic
John.Culleton> representation of a roll of paper, viewed from the end of the
John.Culleton> roll.

John.Culleton> Given the formula I can then crank it into pstricks or some other
John.Culleton> graphics package to generate the figure.

With PSTricks, you can play with the following code and adapt it.

P.S. * You can easily found solutions using other tools, like Metafont or
MetaPost (Alan Hoenig for instance had published some similar examples in
Metafont).
* For PSTricks, this code is notably cleaner and more powerful than the
one I show in "Les Cahiers GUTenberg" in 1994.

\documentclass{article}

\usepackage{pst-plot}
\usepackage{pst-text}

\makeatletter

% D.G. addition - Jun.  9, 1998 - Polar plots using the \psplot macro
% Code added according the way suggested by Ulrich Dirr <udirr at das-team.com>

% For polar plots
\newif\ifpolarplot
\def\psset at polarplot#1{\@nameuse{polarplot#1}}
\psset at polarplot{false}

\def\psplot at i#1#2#3{%
\pst at killglue
\begingroup
\use at par
\@nameuse{beginplot@\psplotstyle}%
% D.G. modification begin - Jun.  9, 1998
\ifpolarplot
\psplot at init
/x #1 def
/x1 #2 def
/dx x1 x sub \psk at plotpoints div def
/xy {% Adapted from \parametricplot at i
#3 dup x cos mul exch x sin mul
\pst at number\psxunit mul exch
\pst at number\psyunit mul exch
} def}%
\else
% D.G. modification end
\psplot at init
/x #1 def
/x1 #2 def
/dx x1 x sub \psk at plotpoints div def
/xy {
x \pst at number\psxunit mul
#3 \pst at number\psyunit mul
} def}%
% D.G. modification begin - Jun.  9, 1998
\fi
% D.G. modification end
\gdef\psplot at init{}%
\@pstfalse
\@nameuse{testqp@\psplotstyle}%
\if at pst
\psplot at ii
\else
\psplot at iii
\fi
\endgroup
\ignorespaces}

% A \doPerChar style macro adapted from Juergen Schlegelmilch
% (<schlegel at Informatik.Uni-Rostock.de> - posted on c.t.t. Jan. 27, 1998)
\def\doPerChar#1#2#3\@nil{%
#1#2%
\edef\@tempa{#3}%
\ifx\@tempa\empty
\else
\doPerChar#1#3\@nil
\fi}

\def\perChar#1#2{\doPerChar#1#2\@nil}

\newdimen\MyDim
\MyDim=0.7pt

\def\CharacterAction#1{%
\pst at dimtonum{\MyDim}{\@tempa}%
\scalebox{1 \@tempa}{#1}

\makeatother

\pagestyle{empty}

\begin{document}

\LARGE

\begin{pspicture}(-3.8,-5)(4.5,4.5)
\pstextpath{\psplot[linestyle=none,polarplot=true,plotpoints=300,unit=5]
{500}{-500}{1 2.7182818 x 200 div exp 1 add div}}% Spiral
{\perChar{\CharacterAction}{3,14159265358979323846264338327950288%
419716939937510582097494459230781640}}
\end{pspicture}

\end{document}

Denis Girou
--
--------------------------------------------------------------------------
Institut du Développement et des Ressources en Informatique Scientifique |
Centre National de la Recherche Scientifique                             |
Bâtiment 506 - B.P. 167 - 91403 Orsay Cedex - France                     |
--------------------------------------------------------------------------

-----------------------------------------------------------------------------